in reply to Re^3: why does push not default to $_? (simple)
in thread why does push not default to $_?
> that _ is already a valid character in prototypes for a scalar argument defaulting to $_, as you want.
well, couldn't find it in the docs perlsub ... ups ...I was scanning the text und examining the examples and tables, but after a textsearch for "_" there is a somehow hidden phrase:
As the last character of a prototype, or just before a semicolon, you can use _ in place of $ : if this argument is not provided, $_ will be used instead.
wow, it's already implemented!
So its possible to override CORE::push with sub push(\@_;@), which will default to $_ if the list is omitted!
That means there is no technical reason that it's not already implemented this way, it's just Larry's decission.
UPDATE Thats wrong, see following post...
This thread is really instructive ... thanx! : )
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: why does push not default to $_? (simple)
by LanX (Saint) on Dec 06, 2008 at 02:00 UTC | |
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 |