in reply to Pushing AoH refs into another AoH ref

japhy's answer (@$allshows) is correct - however it raises the question - why would you want to do it that way - it seems to complicate life without adding value.

Why not just declare my @allshows and push directly into it ? The only good reason NOT to declare it as an array is - if it was passed-in as an array ref, in which case japhy's syntax is a reasonable way to go.

    Earth first! (We'll rob the other planets later)

  • Comment on Re: Pushing AoH refs into another AoH ref

Replies are listed 'Best First'.
Re^2: Pushing AoH refs into another AoH ref
by bradcathey (Prior) on Sep 02, 2004 at 12:45 UTC

    Points well taken. I have amended my code, and it works great. Thanks all.

    my ($shows, $allshows); for my $i ( 0 .. $#ids ) { $stmt = "SELECT * FROM shows WHERE type = 2 AND id = '$ids[$i]'"; $sth = $dbh->prepare($stmt); $sth->execute(); push @$allshows, $sth->fetchall_arrayref({}); }

    —Brad
    "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton