I am looking for a way to capture the ouptut I generate from the code below into a nice hash. The ouptut is in the following format:
$VAR1 = {
'Element' => [
#0
{
'Name' => 'Michael',
'ID' => '3'
},
#1
{
'Name' => 'Paul',
'ID' => '4'
},
#2
{
'Name' => 'Gerry',
'ID' => '5'
}
]
};
and I want a hash :
%Data{ID}={Name};
--------------------------------------------------------
I am extracting and dumping the data as follows:
# extract the data
my $data = $obj->extract($template, $document);
# print it out so we can see we've got what we want to
$Data:
umper::Indent = 3; # pretty print with array indices
print Dumper($data);
----------------------------------------------------------
I can get the data through splitting and map(s///) but its messy. Is the an easy to overcome this.
$VAR1 = {
'Element' => [
#0
{
'Name' => 'Michael',
'ID' => '3'
},
#1
{
'Name' => 'Paul',
'ID' => '4'
},
#2
{
'Name' => 'Gerry',
'ID' => '5'
}
]
};
and I want a hash :
%Data{ID}={Name};
--------------------------------------------------------
I am extracting and dumping the data as follows:
# extract the data
my $data = $obj->extract($template, $document);
# print it out so we can see we've got what we want to
$Data:
print Dumper($data);
----------------------------------------------------------
I can get the data through splitting and map(s///) but its messy. Is the an easy to overcome this.