I think you're missing the point of the _ prototype. In your example you don't make use of it.
The effect of _ is that if the argument is missing, $_ is passed, and thus populates @_. It does not matter if $_ is lexical. These examples may make it a bit clearer.
use 5.010; sub old { say "$_ " . ($_[0] // '<undef>' ) } sub new (_) { say "$_ " . ($_[0] // '<undef>' ) } old() for qw/ global /; new() for qw/ global /; local $_ = 'global'; my $_; old() for qw/ lexical /; new() for qw/ lexical /; __END__ global <undef> global global global <undef> global lexical
lodin
In reply to Re: Underscore _ prototype in 5.10
by lodin
in thread Underscore _ prototype in 5.10
by cdarke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |