http://www.perlmonks.org?node_id=201688


in reply to passing $_ to my function

Maybe something along the lines like:

sub my_sub { my $argument = shift || $_; # do things with $argument }

Be warned: I am not a Perl guru though