Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Passing hash references

by edoc (Chaplain)
on Jan 31, 2005 at 16:14 UTC ( #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? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2022-01-18 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (54 votes). Check out past polls.

    Notices?