in reply to Re^4: why does push not default to $_? (simple)
in thread why does push not default to $_?
So it's possible to use push defaulting to $_, but a second Array to push will be forced into scalar context! 8(use subs 'push'; my @a; $_="x"; # push @a; # Error: "Can't use an undefined value as an ARRAY referen +ce ..." print @a; # Override! sub push (\@_;@) { CORE::push( @{+shift},@_) ; } push @a; print @a; # prints "x" @b=("y","z"); push @a,@b; print @a; # prints "2"
So the prototypesymbol _ doesn't work with parameterlists ...
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: why does push not default to $_? (simple)
by JadeNB (Chaplain) on Dec 07, 2008 at 18:13 UTC | |
by ikegami (Patriarch) on Dec 07, 2008 at 19:04 UTC | |
by LanX (Saint) on Dec 07, 2008 at 19:45 UTC |