Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Internally, how do for() and while() differ?by LanX (Saint) |
on Oct 27, 2015 at 00:59 UTC ( [id://1146046]=note: print w/replies, xml ) | Need Help?? |
for iterates over a list, everything in brackets is expanded (the only exception are ranges ). So <> will create a temporary list. while loops as long a boolean expression is true. This can be used together with an iterator, like while($x=iter()) .
There is no general automatism to set $_ like your example implies, that's just magic behavior of the file iterator <> in
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|