I am trying to get email addresses out of a Sylpheed address book. The
output of Dumper is;
$VAR1 = {
'attribute-list' => [
{}
],
'first-name' => '',
'uid' => '158149473',
'cn' => 'Julie Jumper',
'address-list' => [
{
'address' => [
{
'email' => '[EMAIL PROTECTED]',
'uid' => '158149474',
'remarks' =[1]> '',
'alias' => ''
}
]
}
],
'last-name' => '',
'nick-name' => ''
};
I cannot get my head around extracting the 'email' it seems be be buried
deep inside an array and a hash
Here is an attempt;
#!/usr/bin/perl
use XML::Simple;
use Data::Dumper;
use strict;
my $xml = new XML::Simple (KeyAttr=>[], ForceArray => 1);
my $data = $xml->XMLin("ab6.xml");
foreach my $d (@{$data->{person}}) {
print $d->{cn}; #<- that works
print "\t";
print $d->{"address-list"} # <-need to get down to address and email.
# most attempts failed but some gave a
# hash reference
print "\n";
}
TIA for any assistance/clues
--
Owen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>