in reply to Passing hash references

In general, i access hashrefs values which i dont know their structure by looking at Data::Dumper output, and then:

$hashref->{brackets_1}->{brackets_n}{quotes}

Regarding books, i really like Perl Cookbook, chapter 5 covers this topic.

Also, ive found Merlyn's article List Manipulation, very useful. It was published in April 2004 Linux Magazine issue.

Finaly, you can take a look at Steve's place lesson 7. It is really good.

Replies are listed 'Best First'.
Re^2: Passing hash references
by EchoAngel (Pilgrim) on Jan 31, 2005 at 20:30 UTC
    my $names = &getNames; my $valid_names = &validateNames(\$names); usually, I noticed that &validateNames(\$names); could be &validateNames($names); just to make things easier. However, you can use it, just more messy looking
    sub validateNames{ my $valid_names=shift; print Dumper($valid_names); # I want to access ( print ) the data here my $category = (); foreach $category (sort keys %{${$valid_names}}) { print "INFO - $category . Name : " . ${${$valid_names}}{$category +}{'name'} . "\n"; print "INFO - $category . Email : " . ${${$valid_names}}{$catego +ry}{'email'} . "\n"; } }