LOGONLY mark 1408fb as NODOC since it appears to be a useful but minor warning cleanup
[p5sagit/p5-mst-13.2.git] / x2p / a2p.pod
index 3976aba..d32a9c7 100644 (file)
@@ -4,7 +4,7 @@ a2p - Awk to Perl translator
 
 =head1 SYNOPSIS
 
-B<a2p [options] filename>
+B<a2p> [I<options>] [I<filename>]
 
 =head1 DESCRIPTION
 
@@ -12,7 +12,7 @@ I<A2p> takes an awk script specified on the command line (or from
 standard input) and produces a comparable I<perl> script on the
 standard output.
 
-=head2 Options
+=head2 OPTIONS
 
 Options include:
 
@@ -41,6 +41,29 @@ Any delimiter can be used to separate the field names.
 
 causes a2p to assume that input will always have that many fields.
 
+=item B<-o>
+
+tells a2p to use old awk behavior.  The only current differences are:
+
+=over 5
+
+=item *
+
+Old awk always has a line loop, even if there are no line
+actions, whereas new awk does not.
+
+=item *
+
+In old awk, sprintf is extremely greedy about its arguments.
+For example, given the statement
+
+       print sprintf(some_args), extra_args;
+
+old awk considers I<extra_args> to be arguments to C<sprintf>; new awk
+considers them arguments to C<print>.
+
+=back
+
 =back
 
 =head2 "Considerations"
@@ -82,13 +105,13 @@ block to bypass the block under such circumstances can be simplified
 by removing the conditional in the END block and just exiting directly
 from the perl script.
 
-Perl has two kinds of array, numerically-indexed and associative.  Awk
-arrays are usually translated to associative arrays, but if you happen
-to know that the index is always going to be numeric you could change
-the {...} to [...].  Iteration over an associative array is done using
-the keys() function, but iteration over a numeric array is NOT.  You
-might need to modify any loop that is iterating over the array in
-question.
+Perl has two kinds of array, numerically-indexed and associative.
+Perl associative arrays are called "hashes".  Awk arrays are usually
+translated to hashes, but if you happen to know that the index is
+always going to be numeric you could change the {...} to [...].
+Iteration over a hash is done using the keys() function, but iteration
+over an array is NOT.  You might need to modify any loop that iterates
+over such an array.
 
 Awk starts by assuming OFMT has the value %.6g.  Perl starts by
 assuming its equivalent, $#, to have the value %.20g.  You'll want to
@@ -99,9 +122,9 @@ implicit in the awk script.  There are times when you can move this
 down past some conditionals that test the entire record so that the
 split is not done as often.
 
-For aesthetic reasons you may wish to change the array base $[ from 1
-back to perl's default of 0, but remember to change all array
-subscripts AND all substr() and index() operations to match.
+For aesthetic reasons you may wish to change index variables from being
+1-based (awk style) to 0-based (Perl style).  Be sure to change all
+operations the variable is involved in to match.
 
 Cute comments that say "# Here is a workaround because awk is dumb"
 are passed through unmodified.
@@ -125,7 +148,7 @@ statement that is the last statement executed in a subroutine.  A2p
 catches the most common case, but doesn't analyze embedded blocks for
 subtler cases.
 
-ARGV[0] translates to $ARGV0, but ARGV[n] translates to $ARGV[$n].  A
+ARGV[0] translates to $ARGV0, but ARGV[n] translates to $ARGV[$n-1].  A
 loop that tries to iterate over ARGV[0] won't find it.
 
 =head1 ENVIRONMENT
@@ -134,7 +157,7 @@ A2p uses no environment variables.
 
 =head1 AUTHOR
 
-Larry Wall E<lt>F<lwall@jpl-devvax.Jpl.Nasa.Gov>E<gt>
+Larry Wall E<lt>F<larry@wall.org>E<gt>
 
 =head1 FILES