|
|
| Do you know where your variables are? | |
| PerlMonks |
Re: Passing hashes as arguments to a sub?by jimbojones (Friar) |
| on Nov 28, 2005 at 16:30 UTC ( [id://512385]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Hi TheDamian's new book, Perl Best Practices, covers this in Chapter 9. He recommends passing a hash reference, typically to an anonymous hash.
The reasons given for not passing a list of raw key/value pairs is: Requiring the named arguments to be specified inside a hash ensures that any mismatch, such as:The chapter on subroutines is currently available as a sample chapter on the O'Reilly website for you to peruse. It's a great book, highly recommended.will be reported (usually at compile time) in the callerâs context: - j
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||