![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Sometimes it's in Void Contextby Ovid (Cardinal) |
on May 31, 2002 at 22:43 UTC ( #170848=perlquestion: print w/replies, xml ) | Need Help?? |
Ovid has asked for the wisdom of the Perl Monks concerning the following question: In answering a question on the Perl Beginner's list, I stumbled across the following:
No, it's not an array slice. The "0,1,2" is a list and each element of the list is evaluated from left to right and the results of the last evaluation (2) are returned. Thus, the above snippet prints "bird", but issues no warnings. However, if I change the 1 to a 2:
I get the following:
chromatic guessed that this may be a hack in Perl to allow us to put 1 at the bottom of modules without a warning, but I'm not sure. Is this documented anywhere, or is it a bug? Cheers, Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
Back to
Seekers of Perl Wisdom
|
|