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


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.