Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by hossman (Prior)
on May 02, 2004 at 05:30 UTC ( [id://349754]=note: print w/replies, xml ) Need Help??


in reply to How do I pass more than one array or hash to a subroutine

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://349754]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-23 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found