Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you output an attribute using Perl and XML::Simple
    primarykey
    data
    text
    <pre><code>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-&gt;new(KeepRoot =&gt; 1); my $xml_data = $xml-&gt;XMLin($xml_content); my @items = $xml_data-&gt;{rss}{channel}-&gt;{item}; # print Dumper($xml_data); foreach my $item (@items) { if($item){ print Dumper($item); //This is the dump output print $item-&gt;{author}; #print $item . "\n"; } } } </code></pre> <p>When I try to output the item's author I just get either <code>HASH(Memory Address)</code> or <code>not a hash reference at ... line ...</code></p> <p>Am I doing this incorrectly? Why is it producing this error?</p> <p>Here is the dumper output.</p> <pre><code>$VAR1 = [ { 'link' =&gt; 'http://***.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67229', 'author' =&gt; {}, 'title' =&gt; 'By: ', 'pubDate' =&gt; 'Tue, 08 Jun 2010 12:47 EDT', 'description' =&gt; '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&amp;#039;t recall the product. Ah, advertising.' }, { 'link' =&gt; 'http://***.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67167', 'author' =&gt; {}, 'title' =&gt; 'By: ', 'pubDate' =&gt; 'Mon, 07 Jun 2010 13:26 EDT', 'description' =&gt; 'Fun, fun, fun. A great attitude for all of us to take into our careers.' }, { 'link' =&gt; 'http://****.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67164', 'author' =&gt; 'username', 'title' =&gt; 'By: username', 'pubDate' =&gt; 'Mon, 07 Jun 2010 12:23 EDT', 'description' =&gt; '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' =&gt; 'http://****.com/article/news/betty-white-credits-snickers-golden-opportunities/144290/#comments-67142', 'author' =&gt; {}, 'title' =&gt; 'By: ', 'pubDate' =&gt; 'Mon, 07 Jun 2010 09:50 EDT', 'description' =&gt; 'Solid interview. I will definitely be tuning into &amp;quot;Hot in Cleveland&amp;quot; next week. We ought to enjoy Ms. White&amp;#039;s talents for as long as we have her. She&amp;#039;s great!' } ]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload