in reply to Re: How to stuff space separated column into Hash
in thread How to stuff space separated column into Hash
thanks marshall
Ideally, I'd like to use a Hash of Hashes and I have the following code
while ( my @row = $sth->fetchrow_array() ) { print ">@row<\n"; ($key, $value) = split ' ', $row[1]; $HoH{$row[0]}{$key} = $value; } while ( ($client, $months) = each %HoH ) { print "$client: "; while ( ($month, $count) = each %$months ) { print "$month=$count "; } print "\n"; }
the problem is the split to get the $key and $value only gets the first key->value pair. Is there a way to get all of the key-value pairs into the HoH?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to stuff space separated column into Hash
by dirtdog (Monk) on Aug 29, 2016 at 21:01 UTC | |
by Marshall (Canon) on Aug 29, 2016 at 21:51 UTC |