This chapter points out traps and pitfalls you may run into if you are
used to awk, C, sed or shell programming.
Accustomed awk users should take special note of the
following:
ifs and whiles.substr() and index().split operator has different
arguments.print statement does not add field and record separators unless
you set `$,' and `$\'.next, exit and continue work differently.Awk Perl ARGC $#ARGV ARGV[0] $0 FILENAME $ARGV FNR $. - something FS (whatever you like) NF $#Fld, or some such NR $. OFMT $# OFS $, ORS $\ RLENGTH length($&) RS $/ RSTART length($`) SUBSEP $;
awk construct through a2p and see what
it gives you (see section a2p - Awk to Perl Translator for more info).Cerebral C programmers should take note of the following:
ifs and whiles.
elsif rather than else if
break and continue become last and next,
respectively.switch statement.
printf does not implement `*'.
link, unlink, rename, etc. return
nonzero for success, not zero (0).
Seasoned sed programmers should take note of the following:
Sharp shell programmers should take note of the following:
csh.csh) do several levels of substitution on each
command line. Perl does substitution only in certain constructs
such as double quotes, backticks, angle brackets and search
patterns.