![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^5: awk like question in perlby davido (Cardinal) |
on Aug 12, 2004 at 20:45 UTC ( #382458=note: print w/replies, xml ) | Need Help?? |
print +(split)[1,5], $/ while <DATA>;
Could also be written like this:
The unary + sign is used to signal to Perl that you mean print( (split)[1,5], "\n" ); and not print(split[1,5]),"\n"; (which doesn't make sense, but is confusing to Perl nevertheless. For a description of split, see split. For a description of using slices, see perldata. For a description of what $/ is, see perlvar. And for an explanation of the "do something while condition" syntax, see perlsyn. Dave
In Section
Seekers of Perl Wisdom
|
|