Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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
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 studying the Monastery: (5)
As of 2021-05-16 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (152 votes). Check out past polls.

    Notices?