in reply to Can I tell a sub to take $_ instead of @_ (like some builtins do)

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
Because $_ is global you should be able to access it from anywhere (but be careful not to mess with it!).
HTH

_________
broquaint

  • Comment on Re: Can I tell a sub to take $_ instead of @_ (like some builtins do)
  • Download Code