rose has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I want to use grep or map for the following refrence to find the child keys of 'Orange'.
use warnings; use strict; my $xml = { 'Fruits' => [ { 'Season' => { 'Apple' => { 'UnitsAvailable'=> ['100'] }, 'Orange' => { 'UnitsAvailable' => ['200'] } } } ] };
I tried the following code, but it is not finding
my @res = grep (/Orange/, $xml);
Please help to find the child keys of Orange.
Thanks
Rose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep in hash of array
by Corion (Patriarch) on Aug 05, 2008 at 12:15 UTC | |
by rose (Beadle) on Aug 05, 2008 at 12:19 UTC | |
by Corion (Patriarch) on Aug 05, 2008 at 12:20 UTC | |
|
Re: grep in hash of array
by apl (Monsignor) on Aug 05, 2008 at 12:29 UTC | |
by davorg (Chancellor) on Aug 05, 2008 at 13:51 UTC | |
|
Re: grep in hash of array
by chakram88 (Pilgrim) on Aug 05, 2008 at 16:50 UTC | |
|
Re: grep in hash of array
by JavaFan (Canon) on Aug 05, 2008 at 12:45 UTC |