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

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

Replies are listed 'Best First'.
Re^3: Sorting RSS items out of XML::RSS
by johnnywang (Priest) on Aug 17, 2004 at 06:00 UTC
    You need to use array references rather than arrays, so replace your:
    push @megarray, @holdarray;
    by
    push @megarray, \@holdarray;