Here is a code snippet which uses a XML:

imple to get the content for a given node. I am expanding it to get content for any given number of nodes, in my case its 3. What i am getting here is firstnode and all other nodes under that and it repeats for n number of first nodes. I want first nodes of 3 nodes together then next 3 and the step continues till none available.
[html]
use strict;
use XML:

arser;
use LWP:

imple;
my $title; # Hashref containing infos on a title
my $pubdate;
my $cb_ticker = "booklist.xml";
# we should really check if it succeeded or not
my $parser = new XML:

arser ( Handlers => { # Creates our parser object
Start => \&hdl_start,
End => \&hdl_end,
Char => \&hdl_char,
Default => \&hdl_def,
});
$parser->parsefile($cb_ticker);
# The Handlers
sub hdl_start{
my ($p, $elt, %atts) =
@_;
return unless $elt eq 'title';
$atts{'_str'} = '';
$title = \%atts;
return unless $elt eq 'pubDate';
$pubdate = \%atts;
}
sub hdl_end{
my ($p, $elt) =
@_;
format_title($title) if $elt eq 'title' && $title && $title->{'_str'} =~ /\S/;
format_title($pubdate) if $elt eq 'pubDate' && $pubdate && $pubdate->{'_str'} =~ /\S/;
}
sub hdl_char {
my ($p, $str) =
@_;
$title->{'_str'} .= $str;
$pubdate->{'_str'} .= $str;
}
sub hdl_def { } # We just throw everything else
sub format_title { # Helper sub to nicely format what we got from the XML
my $atts = shift;
$atts->{'_str'} =~ s/\n//g;
print "$atts->{'_str'}\n";
undef $title;
}
[/html]
How can i get title and publish date together displayed something like this
title1 pubdate1
title2 pubdate2
...
titleN pubdateN
Thank You