Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: passing $_ to my function

by davorg (Chancellor)
on Sep 30, 2002 at 12:15 UTC ( [id://201693]=note: print w/replies, xml ) Need Help??


in reply to Re: passing $_ to my function
in thread passing $_ to my function

That breaks if you pass an argument that evaluates as false. I'd do something like this:

sub my_sub { my $arg = @_ ? shift : $_; # do stuff }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://201693]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-23 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found