What I want is the description of Item1. So I have something like this to capture the data.$VAR1 = { 'Stuff1' => 'Data Stuff', 'ImportantStuff' => { 'MoreStuff' => { ... }, 'VeryImportantStuff' => { 'Item1' => { 'Description' => 'Need To Know', 'Date' => '20040101', }, 'Item2' => { ... }, 'Item3' => { ... }, }, }, };
Then I get the following output:#pseudo code struct SubFields => { Description => '$', Date => '$', }; my $s = XML::Simple->new; my $tree = $s->XMLin($someFile); my $subfields = SubFields->new(); $subfields->Description ( $tree->{ImportantStuff}->{VeryImportantStuff +}->{Item1}->{Description} ); print Dumper($subfields); print Dumper($tree);
As you can see the data was not retrieved, and the tree now has a new empty entry.$VAR1 = bless({ 'SubFields::Description' => undef, 'SubFields::Date' => undef, }, 'SubFields'); $VAR1 = { 'ImportantStuff' => { 'VeryImportantStuff' => { 'Item1' => {} } }, }, 'Stuff1' => 'Data Stuff', 'ImportantStuff' => { 'MoreStuff' => { ... }, 'VeryImportantStuff' => { 'Item1' => { 'Description' => 'Need To Know', 'Date' => '20040101', }, 'Item2' => { ... }, 'Item3' => { ... }, }, }, };
In reply to XML::Simple Hashes of Ref's of Hashs of Ref's... by ralibm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |