On Jun 26, Pedro A Reche Gallardo said:

>eval 'exec /usr/sbin/perl -S $0 ${1+"$@"}'
>    if $running_under_some_shell;
>   # this emulates #! processing on NIH machines.
>   # (remove #! line above if indigestible)

That is just for OSs that can't handle #! lines.

>eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
>   # process any FOO=bar switches

This is nifty.  This takes an argument like "FOO=bar", and puts "FOO=" in
$1 and "bar" in $2.  Then it executes the code

  $FOO=$2;

which sets $FOO to the value of $2, which is "bar".

>$[ = 1;   # set array base to 1

(Ick.)  That's so that arrays start at 1 like the $NUM variables do in
awk.

>$, = ' ';  # set output field separator

This is for lists:

  $, = "-";
  print 1,2,3,4;  # prints 1-2-3-4

>$\ = "\n";  # set output record separator

This is for the end of each print() statement:

  $\ = "FOO";
  print "hi";   # prints "hiFOO"
  print "bye";  # prints "byeFOO";

>while (<>) {
>    chop; # strip record separator
>    @Fld = split(' ', $_, 9999);
>    if (!($Fld[2] < 0.8 && $Fld[3] =~ /\./)) {
> print $_;
>    }
>}

This is just a translation of the meat of the awk code to Perl.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to