Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How Do I pass a hash to a subroutine?

by MeowChow (Vicar)
on Feb 26, 2001 at 05:15 UTC ( [id://60804]=note: print w/replies, xml ) Need Help??


in reply to How Do I pass a hash to a subroutine?

Hashes can be passed either by value:
mysub(%hash); sub mysub { my (%params) = @_; }
or by reference:
mysub(\%hash); sub mysub { my $params = shift; my %paramhash = %$params; }
Each approach has it's advantages and disadvantages. Pass-by-value offers a simpler syntax, while pass by reference is faster and more flexible, allowing you to easily intermingle the hash with other parameters.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://60804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-29 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found