Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

(MeowChow) Re: passing arguments

by MeowChow (Vicar)
on Apr 25, 2002 at 04:47 UTC ( #161853=note: print w/ replies, xml ) Need Help??


in reply to passing arguments

There's a time and place for everything. For some functions, it makes sense to accept an ordered paramenter list. For others, it makes sense to accept a list of key/value pairs. And sometimes, it's useful to pass around an anomyous hash by reference, as you've suggested.

Saying there's exactly one right way to do it is an open invitation to a holy war. As long as you understand the benefits and tradeoffs of each method, you'll do fine. Blind adherance to an arbitrary rule such as "never write a function that takes more than one argument" is just silly.

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print


Comment on (MeowChow) Re: passing arguments
Re: (MeowChow) Re: passing arguments
by mstone (Deacon) on Apr 25, 2002 at 20:11 UTC
    Saying there's exactly one right way to do it is an open invitation to a holy war.

    That's very true. And I feel free to break any of my own rules if the situation warrants it. I state this one strongly because I try to avoid breaking it if at all possible. I find that reshuffling the data to support one-parameter logic helps me build better, more robust code.

    I'll be happy to scale this one back to "try to code for single parameters if possible" if the rest of the monastery will give up equivalent dicta, like "use CGI.pm or die." ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-08-21 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (127 votes), past polls