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

Re: Hash as Hash Value

by lostjimmy (Chaplain)
on Apr 20, 2010 at 19:37 UTC ( [id://835868]=note: print w/replies, xml ) Need Help??


in reply to Hash as Hash Value

Your main problem is that the values of hashes can only be scalars, and not entire hashes. Lucky for you, a hash references (hashref) is also a scalar. You want to create your %args hash like this: my %args = (users => \%userHash, domains => \%domainHash, path => $path);

In your subroutine, you have to dereference the hashrefs in order to use them.

sub doSomethingUseful { my $args = shift; my $users = $args->{users}; my $domains = $args->{domains}; my $path = $args->{path}; if (keys %$users > 1) { print("I was hoping you'd say that."); } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found