Rhodium has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I am having some difficulty parsing back out the data contained in a hash reference. I am looking to print the data that I have passed in the reference. I can do it with Dumper but that's it.
I would REALLY like a pointer to the perl books on where this is covered. I need to bookmark it.
TIA
I am having some difficulty parsing back out the data contained in a hash reference. I am looking to print the data that I have passed in the reference. I can do it with Dumper but that's it.
I would REALLY like a pointer to the perl books on where this is covered. I need to bookmark it.
use strict; use Data::Dumper; my $names = &getNames; my $valid_names = &validateNames(\$names); sub getNames { my %data; $data{'SCM555'}{'name'}='foo'; $data{'SCM555'}{'email'}='foo@bar.com'; $data{'SCM556'}{'name'}='foo2'; $data{'SCM556'}{'email'}='foo2@bary.com'; return \%data; } sub validateNames{ my $valid_names=shift; print Dumper($valid_names); # I want to access ( print ) the data here }
TIA
Rhodium
The seeker of perl wisdom.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Passing hash references
by borisz (Canon) on Jan 31, 2005 at 16:07 UTC | |
by Tanktalus (Canon) on Jan 31, 2005 at 16:23 UTC | |
Re: Passing hash references
by olivierp (Hermit) on Jan 31, 2005 at 16:21 UTC | |
Re: Passing hash references
by edoc (Chaplain) on Jan 31, 2005 at 16:14 UTC | |
Re: Passing hash references
by bgreenlee (Friar) on Jan 31, 2005 at 16:16 UTC | |
Re: Passing hash references
by fauria (Deacon) on Jan 31, 2005 at 16:24 UTC | |
by EchoAngel (Pilgrim) on Jan 31, 2005 at 20:30 UTC |
Back to
Seekers of Perl Wisdom