![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
comment on |
( #3333=superdoc: 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 reply to Re^5: awk like question in perl
by davido
|
|