$VAR1 = { 'xml_api_reply' => { '-version' => '1', 'weather' => { .... } $VAR1 = { 'xml_api_reply' => { '-version' => '1', 'weather' => { .... } .... #### #!/usr/bin/perl -w use strict; use CGI qw(-oldstyle_urls :standard); use XML::TreePP; use XML::XPath; use XML::Simple; use Data::Dumper; use Date::Format; use Date::Parse; my $q = new CGI; $| = 1; my @zipcode = qw(02151 01908 02638 02669 02670 02536 02642 02574 02332 02601 02045 01930 02152 27943 02169); my ($currtempf, $currtempc, $currhumidity, $currcondition, $currwind, $todayhigh, $todaylow, $todaycond, $tomorrowcond); my ($city, $url, $tpp, $tree); #set $Data::Dumper::Purity to 1 if you have nested references $Data::Dumper::Purity = 1; open (FILE, "> data.txt") or die "can't open $tree: $!"; foreach my $zip(@zipcode) { next unless $zip =~ /^(\d{5})$/; $url = "http://www.google.com/ig/api?weather=".$zip ; $tpp = XML::TreePP->new(); $tree = $tpp->parsehttp( GET => $url ); print FILE Dumper($tree); } close FILE or die "can't close $tree: $!";