Perl: the Markov chain saw | |
PerlMonks |
Re: Having to specify $_by sauoq (Abbot) |
on Dec 09, 2002 at 03:15 UTC ( [id://218440]=note: print w/replies, xml ) | Need Help?? |
Functions do not assign to $_ by default. Consider You wouldn't expect that to print 'foo', would you? Well, the while loop doesn't make it any different. You have probably been confused by things like while (<>) {} (which works because <> assigns to $_ by default) and for (@list) {} which works because for will use $_ by default when an iteration variable isn't named. -sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|