|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Sometimes it's in Void Contextby Ovid (Cardinal) |
| on May 31, 2002 at 18:43 UTC ( [id://170848]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.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
|
|
||||||||||||||||||||||||