Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Need to get hash of arrays

by 1nickt (Canon)
on May 14, 2021 at 09:59 UTC ( [id://11132573]=note: print w/replies, xml ) Need Help??


in reply to Need to get hash of arrays

Hi,

By the pipe separator it looks like you are retrieving the data from a MySQL or other database. Is that the case? If so you can populate your hash of arrays while you are fetching the results from the DB.

while ( my $row = $sth->fetchrow_arrayref ) { push( @{ $hash{$row->[0]} }, $row->[1] ); }

Hope this helps!


The way forward always starts with a minimal test.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-03-28 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found