I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-07-26 21:22:50.262403-07 by opcraft
Can't correctly display elements
What am I doing wrong? I'm trying to derive elements of an XML file. Here is my program:
#!/usr/bin/perl use XML::Simple; use LWP::Simple; $xml = new XML::Simple; my $web_source = get( "http://www.narberthusa.com/feeds/posts/default" ); $data = $xml->XMLin($web_source, forcearray => 1); foreach $a (@{$data->{entry}}) { print ++$c . "\n"; print "$a->{title}\n"; print $a->{author} . "\n"; print $a->{content} . "\n\n"; }
and here is what I get:
1 ARRAY(0x100a5e530) ARRAY(0x100a5c4d0) HASH(0x100a8ec80) 2 ARRAY(0x100a5c260) ARRAY(0x100a5b0a0) HASH(0x100a8c6d8) 3 ARRAY(0x100a5ae60) ARRAY(0x100a5acc8) HASH(0x100a8d2e8)
...and so forth. Anyone have any suggestions for me?
Direct Responses: 12838 | Write a response
Posted on 2010-07-27 02:53:24.781087-07 by grantm in response to 12837
Re: Can't correctly display elements

Some suggestions ...


• Take your question to www.perlmonks.org or stackoverflow.com you will get quality answers faster there.


• Use Data::Dumper to display the data structure returned by XMLin.


• If the answer is not obvious to you once you have used Data::Dumper then you probably need to read perlreftut - a tutorial on Perl references.


This article helps you avoid common pitfalls with XML::Simple and this one helps you move to a better module.

Direct Responses: Write a response