in reply to Sorting RSS items out of XML::RSS

If you're having problem extracting what you want in place from the $rss instance, the best first step might be to extract all the information you're interested in (description, title, your kiwi tags :) from it and into a new data structure. Then operate on that rather than trying to manipulate the raw data (not that you probably couldn't do it in place, it may be easier to think about it in your terms rather than XML::RSS').

Replies are listed 'Best First'.
Re^2: Sorting RSS items out of XML::RSS
by stuie (Initiate) on Aug 17, 2004 at 05:34 UTC

    Thanks Fletch!

    I have tried to create my own structure, along the following lines:

    foreach my $item (@{$rss->{'items'}}) { my $title=$item->{'title'}; my $link=$item->{'link'}; my $description=$item->{'description'}; my $date_valid=$item->{nzgls}->{'date.valid'}; my $doc_type=$item->{nzgls}->{'type.document'}; my $identifier=$item->{nzgls}->{'identifier'}; @holdarray="$title", "$link", "$date_valid", "$doc_type", "$identifier", "$description"; }

    So far, so good. But when I get down to building a parent array to store the items in for sorting...

    push @megarray, @holdarray; print "$megarray[0][1]\n";

    I get: "Can't use string ("") as an ARRAY ref while "strict refs" in use at ./rss-experiment.pl line 114."

    I'm thinking the line when I push @holdarray into @megarray probably isn't doing what I'm thinking it is :)

    Thanks,

    Stuart

      You need to use array references rather than arrays, so replace your:
      push @megarray, @holdarray;
      by
      push @megarray, \@holdarray;