Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Having to specify $_

by runrig (Abbot)
on Dec 09, 2002 at 04:26 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-10-02 07:27 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (8 votes). Check out past polls.