Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: passing subroutine arguments directly into a hash

by drewbie (Chaplain)
on Oct 20, 2001 at 08:50 UTC ( [id://120210]=note: print w/replies, xml ) Need Help??


in reply to Re: passing subroutine arguments directly into a hash
in thread passing subroutine arguments directly into a hash

sub sub1 { my %args = ( arg1 => 'default', arg2 => 0, arg3 => undef, @_ ); }
I personally prefer this approach because it 1) tells me what parameters I am expecting and 2) it allows me to set defaults. Yes, it takes up a lot of space visually, but who the heck cares since it makes the code that much more readable. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (None)
    As of 2024-04-19 00:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found