http://www.perlmonks.org?node_id=11131462


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

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' } ] } };
It looks like the hash reference you want is just the value of the 'ref' key. See also perldsc.


Give a man a fish:  <%-{-{-{-<