Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Passing hashes to subs?by flocto (Pilgrim) |
on Aug 01, 2002 at 11:41 UTC ( [id://186740]=note: print w/replies, xml ) | Need Help?? |
Besides the options mentioned above (using references..) you can also do either of these:
...which only workes if the hash is the only argument you have (or the last one..). If it is not, or you have more than one hash to pass, and your subroutine is seen at sompile ime, you can use this elegant solution:
The second example provides a prototype for the subroutine. How these work can be read in perlsub.. But to give you some clue: It automatically converts the hash into a reference.. Regards,
In Section
Seekers of Perl Wisdom
|
|