http://qs321.pair.com?node_id=426638


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