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

Answer: How do I pass more than one array or hash to a subroutine

by hossman (Prior)
on May 02, 2004 at 05:30 UTC ( #349754=categorized answer: print w/replies, xml ) Need Help??

Q&A > subroutines > How do I pass more than one array or hash to a subroutine - Answer contributed by hossman

If you declare your subroutine with a function prototype specifying each argument as \% or \@, then your method will automatically get a reference to the hashes/arrays passed to it, without the person calling the function/method/subroutine needing to do anything special.

Note that, like all prototypes, this doesn't work when calling the subroutine using & or as a method.

See the 'Prototypes' section of perlsub for more details, or this node for a good example.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2016-10-25 20:17 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.