in reply to Re^2: shift in list context buggy?
in thread shift in list context buggy?
"shift could easily return an empty list and $x is still undef."
It could easily, yes. But it doesn't. And it's documented as retuning undef. To do something different may well subtly break a lot of code on CPAN.
That said, shift is one of those keywords that Perl allows you to override...
use subs 'shift'; sub shift (+) { my $arr = $_[0]; @$arr ? CORE::shift(@$arr) : (); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: shift in list context buggy?
by morgon (Priest) on Nov 09, 2013 at 18:41 UTC | |
by tobyink (Canon) on Nov 10, 2013 at 09:13 UTC | |
by Athanasius (Archbishop) on Nov 10, 2013 at 07:05 UTC | |
by LanX (Saint) on Nov 10, 2013 at 07:16 UTC |