http://qs321.pair.com?node_id=218448


in reply to Having to specify $_

Well, you could say:
{ push @results, $sth->fetchrow_hashref || last; redo; }
But I think you'd be better off with a fetchall_arrayref or selectall_arrayref:
@results = @{$sth->fetchall_arrayref({})};
Update: Had a pop after the first bit of code. Didn't need it (it was a mistake since the last push pushes an empty list).

Another update: That first example is deprecated. From the DBI docs on fetchrow_hashref:

Currently, a new hash reference is returned for each row. This will change in the future to return the same hash ref each time, so don't rely on the current behaviour.