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

Re: Passing hash references

by edoc (Chaplain)
on Jan 31, 2005 at 16:14 UTC ( [id://426638]=note: print w/replies, xml ) Need Help??


in reply to Passing hash references

I'll hazard a guess that your confusion stems from a single extra character in your code..

my $valid_names = &validateNames(\$names);

You don't need the '\' before names. It's already a reference as returned by getNames, so you're actually sending a reference-to-a-reference to your function. Change it to:

my $valid_names = &validateNames($names); # or even my $valid_names = validateNames($names);

and you'll be able to access the values in your validateNames function with:

print $valid_names->{SCM555}{name};

cheers,

J

Log In?
Username:
Password:

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

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

    No recent polls found