Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: how do I use a hash of hashes reference to a function ?

by Fastolfe (Vicar)
on Sep 22, 2000 at 02:28 UTC ( #33577=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub function {
       my $hashref = shift;
    ...
    my %hash = ( one => 1, two => 2 );
    &function(\%hash);
    print join(", ", keys %hash);   # one, two, three
    
  2. or download this
    sub function (%) {
       my %hashref = shift;
    ...
    }
    
    &function(%hash);       # passes %hash as a ref
    
  3. or download this
    sub function {
       my %hash = %{shift};   # de-references
    
       $hash{three} = 3;      # Does not affect the real %hash!
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2020-10-31 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (287 votes). Check out past polls.

    Notices?