#!/usr/bin/perl use strict; use warnings; use LWP::Simple qw(getstore); use Data::Dumper; use XML::Simple qw(:strict); getstore('http://gdata.youtube.com/feeds/api/users/user/contacts?start-index=1&max-results=50', 'contact.xml'); my $xml = XML::Simple->new; my $hashref = $xml->XMLin('contact.xml',ForceArray => 1, KeyAttr => []); open (XMLEXPORT, ">test.txt"); print XMLEXPORT Dumper($hashref); close (XMLEXPORT); foreach my $content (keys %$hashref) { if ( ref($hashref->{$content}) eq 'ARRAY' and @{$hashref->{$content}} > 0) { my @tmp = @{$hashref->{$content}}; foreach my $value (@tmp) { print $content." => ".$value."\n"; } } else { print $content." => ".$hashref->{$content}."\n"; } }