John W . Krahn schreef:
> Rodrick Brown:
>> John W. Krahn:
>>> perl -ane'$total+=$F[4]}{printf"Avg: %.2f\n",$total/$.'
>>> /tmp/filename
>>
>> Hi John please explain how exactly $F[4] works? how is it set?
Use -MO=Deparse to show you what Perl code your command line expression
was compiled to.
$ perl -MO=Deparse -ane'
> $total+=$F[4]}{printf"Avg: %.2f\n",$total/$.
> '
LINE: while (defined($_ = <ARGV>)) {
our(@F) = split(" ", $_, 0);
$total += $F[4];
}
{
printf "Avg: %.2f\n", $total / $.;
}
-e syntax OK
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/