Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Having to specify $_

by runrig (Abbot)
on Dec 09, 2002 at 04:26 UTC ( [id://218448]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218448]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found