is a shorthand for
Personally I'd write
while (<>) { last if /pattern/; ... }
I find this more readable. YMMV!
HTH :)
B::Deparse can help you explore the difference
C:\>perl -MO=Deparse -e"while (<>) {}" while (defined($_ = readline ARGV)) { (); } -e syntax OK C:\>perl -MO=Deparse -e"while (<> and !/pattern/) {}" while (readline ARGV and not /pattern/) { (); } -e syntax OK C:\>
°)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: $_ not set in while <>
by LanX
in thread $_ not set in while <>
by pidloop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |