1) $_ is often treated as a default argument to a function, for example for chop and as a default second argument for split. This in no way implies it should be a default LHS to an omitted assignment, just because shift takes an array argument rather than a scalar.
2) shift does have a default argument, @_, because it takes an array argument rather than a scalar.
3) using $_ as a default argument is a reasonably safe implementation, because it is applied only when the relevant argument is explicitly omitted from an actual function call; in other words is free from ambiguous meaning (including in a DWIM sense). But the intended meaning for an omitted assignment to a function call is that its return value is available for direct evaluation (e.g. MyFunc(shift())), which may be delayed to the next statement for some cases, but either way is never assigned to $_. So the precedent is in fact never to do what is suggested in the OP.
3) (conclusion) the proposed implementation is unsafe because $_ is intended to preserve its contents across scope and context boundaries, unless explicity assigned otherwise (omission of required arguments being deemed explicit enough), including for functions. The implementation proposed in the OP would therefore destroy the main purpose of $_.
One world, one people
In reply to Re: shift doesn't DWIM
by anonymized user 468275
in thread shift doesn't DWIM
by GrandFather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |