Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Potential Ternary Operator Bugby davorg (Chancellor) |
on Dec 10, 2001 at 20:36 UTC ( [id://130696]=perlquestion: print w/replies, xml ) | Need Help?? |
davorg has asked for the wisdom of the Perl Monks concerning the following question: This just came up in the CB. Someone wanted to filter an array into two arrays. I decided to be clever and suggested this:
That works as expected, but it turned out that the filtering should be done on a regex match. I changed my code to:
But that gives a "Bizarre copy of ARRAY in leave" error. Changing it again to:
gets it working again. And on reflection, that's what should work. So, I guess the original version shouldn't work (you should need to take references in that case as well). But it does. Any explaination? --<http://www.dave.org.uk> "The first rule of Perl club is you do not talk about
Perl club."
Back to
Seekers of Perl Wisdom
|
|