sub parse_xml{
    my $xml_link = $_[0];
    my $xml_content = get($xml_link) or warn "Cant get XML page of " . $xml_link . "\n";
    if(!$xml_content){
        return;
    }
    my $xml =  XML::Simple->new(KeepRoot => 1);
    my $xml_data = $xml->XMLin($xml_content);
    my @items = $xml_data->{rss}{channel}->{item};
   # print Dumper($xml_data);
    foreach my $item (@items) {
        if($item){
             print Dumper($item);             //This is the dump output
             print $item->{author};
             #print $item . "\n";
        }
    }
}
当我尝试输出项目的作者时,我只会得到HASH(Memory Address)或not a hash reference at ... line ...
我做错了吗?为什么会产生这个错误?
这是转储程序的输出。
$VAR1 = [
          {
            'link' => 'http://***.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67229',
            'author' => {},
            'title' => 'By: ',
            'pubDate' => 'Tue, 08 Jun 2010 12:47 EDT',
            'description' => 'Interesting. At least SHE remembered the product that propelled her to recent recognition. When many people I know have commented on how they loved that Betty White Super Bowl spot, they can't recall the product. Ah, advertising.'
          },
          {
            'link' => 'http://***.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67167',
            'author' => {},
            'title' => 'By: ',
            'pubDate' => 'Mon, 07 Jun 2010 13:26 EDT',
            'description' => 'Fun, fun, fun. A great attitude for all of us to take into our careers.'
          },
          {
            'link' => 'http://****.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67164',
            'author' => 'username',
            'title' => 'By: username',
            'pubDate' => 'Mon, 07 Jun 2010 12:23 EDT',
            'description' => 'Her appearance of the Comedy Central roast of William Shattner a couple of years ago was great... it seems like her willingness to be irreverent makes her more appealing to us all!  
www.adverspew.com'
          },
          {
            'link' => 'http://****.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67142',
            'author' => {},
            'title' => 'By: ',
            'pubDate' => 'Mon, 07 Jun 2010 09:50 EDT',
            'description' => 'Solid interview. I will definitely be tuning into "Hot in Cleveland" next week. We ought to enjoy Ms. White's talents for as long as we have her. She's great!'
          }
        ];