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

Re: Re: passing subroutine arguments directly into a hash

by drewbie (Chaplain)
on Oct 20, 2001 at 08:50 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-05-21 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?