in reply to Having to specify $_
Well, you could say:
But I think you'd be better off with a fetchall_arrayref or selectall_arrayref:{ push @results, $sth->fetchrow_hashref || last; redo; }
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).@results = @{$sth->fetchall_arrayref({})};
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.
In Section
Seekers of Perl Wisdom