in reply to How do I get a list in a perl hash generated from an XML?
If you're determined to disregard the sound advice against the use of XML::Simple, you can do
It looks like the hash reference you want is just the value of the 'ref' key. See also perldsc.Win8 Strawberry 5.8.9.5 (32) Mon 04/19/2021 5:08:21 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings use Data::Dumper; my $got_data = { 'ref' => { 'abc_sia_%version1.ref' => { 'func' => [ { 'envname' => 'test01', 'objectdir' => '/home/pv66', 'base' => 'default_771' } ] } } }; my $want_data = $got_data->{'ref'}; print Dumper $want_data; ^Z $VAR1 = { 'abc_sia_%version1.ref' => { 'func' => [ { 'base' => 'defaul +t_771', 'objectdir' => '/ +home/pv66', 'envname' => 'tes +t01' } ] } };
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do I get a list in a perl hash generated from an XML?
by PV66 (Novice) on Apr 19, 2021 at 09:46 UTC |