Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

(MeowChow) Re: passing arguments

by MeowChow (Vicar)
on Apr 25, 2002 at 04:47 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://161853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found