I didn't see you assign a value to %forecast but you can loop through it,why?
----- Original Message -----
From: Richard Lee
To: Perl Beginners
Subject: trying to parse out the simple xml file from the book with XML::Parser
and I get not well-formed error
Date: 2008-11-3 09:48:05
use strict;
use warnings;
use XML::Parser;
my %forecast;
my @curr;
my $type;
my $p1 = new XML::Parser(Style => 'Stream');
my $yahoo = shift;
$p1->parsefile($yahoo);
print "Outlook: $forecast{outlook}\n";
foreach (keys %forecast) {
next if /outlook/;
print "$_: $forecast{$_}->{val} $forecast{$_}->{deg}\n";
}
-------------------------------------------------------------------
新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )