fionbarr has asked for the wisdom of the Perl Monks concerning the following question:
given the following hash how do I print the number of children? use Data::Dumper; %barry = ( name => Barry, age => 67, children => [ # anon array of hashes { # anon hash 1 name => Jenny, age => 38, education => BA }, { name => Brendan, age => 20, education => student } ] ); for $i (0 .. 1) { print $barry{children}->[$i]->{name} . "\n"; print $barry{children}->[$i]->{age} . "\n" ; print $barry{children}->[$i]->{education} . "\n" ; print "-----------------------\n"; } print Dumper(%barry);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: array of hashes
by kyle (Abbot) on Oct 02, 2008 at 15:12 UTC | |
by fionbarr (Friar) on Oct 02, 2008 at 15:31 UTC | |
|
Re: array of hashes
by eighty-one (Curate) on Oct 02, 2008 at 15:19 UTC | |
by fionbarr (Friar) on Oct 02, 2008 at 15:30 UTC | |
|
Re: array of hashes
by toolic (Bishop) on Oct 02, 2008 at 15:18 UTC | |
|
Re: array of hashes
by NetWallah (Canon) on Oct 02, 2008 at 21:20 UTC | |
|
Re: array of hashes
by ikegami (Patriarch) on Oct 02, 2008 at 20:05 UTC |