Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[ambrus]: "could evacuate to open schoolyard and then call or go back to school" => wait what? like power cycling the school building by removing all the kids and then reentering them? how would that fix the problems?
[ambrus]: https://www.xkcd. com/723/ is relevant about earthquakes and phones
[ambrus]: must be this earthquake
[ambrus]: (It's convenient that I live in a place with no earthquakes or hurricanes. One less bad thing to look out for.)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-01-18 12:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (161 votes). Check out past polls.