in reply to Re: why does push not default to $_?
in thread why does push not default to $_?

There is a default stack. At least according to shift and pop.

Making 1-arg push (and unshift) work with @_ (or @ARGV) as a default 1st arg would, IMHO, be more consistent (I have accidentally expected this behaviour once). Unfortunately, its not terribly useful. I don't find myself adding to @_ frequently.

Replies are listed 'Best First'.
Re^3: why does push not default to $_?
by ikegami (Patriarch) on Dec 07, 2008 at 17:47 UTC

    It's not a good idea. The only thing you could push onto the "stack" is would be the contents of an array. For example, you can't make push $foo; work without breaking push @foo, $x;. The usefulness of the feature is just too limited to compensate for the confusion the its implementation would cause.