Because $_ is global you should be able to access it from anywhere (but be careful not to mess with it!).sub foo { # changing $_ is not a good idea local $_ = $_; print "\$_ is currently: $_" } foo foreach qw(one two three four); __output__ $_ is currently: one $_ is currently: two $_ is currently: three $_ is currently: four
_________
broquaint
In reply to Re: Can I tell a sub to take $_ instead of @_ (like some builtins do)
by broquaint
in thread Can I tell a sub to take $_ instead of @_ (like some builtins do)
by statebelt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |