in reply to passing $_ to my function

Check if you've got any arguments otherwise default to $_ e.g
sub def_arg { my $arg = @_ ? shift : $_; print "got: $arg\n"; } $_ = "bar"; def_arg("foo"); def_arg(); __output__ got: foo got: bar

HTH

_________
broquaint