in reply to Appending values to existing hash key
But this modifies the $val.$val=~s/\s+/:/g;
For the second question of appending to hash values, I'd suggest a better structure would be a hash of arrays"
That way, you do not need to check for existance - it is auto-vivified.push @{ $hash{$key} }, $v;
... output for each $key .... join $sep,@{ $hash{$key} }
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Appending values to existing hash key
by jaypal (Beadle) on Mar 21, 2014 at 03:31 UTC | |
by 2teez (Vicar) on Mar 21, 2014 at 04:11 UTC | |
by NetWallah (Canon) on Mar 21, 2014 at 04:47 UTC | |
by 2teez (Vicar) on Mar 21, 2014 at 06:56 UTC | |
by jaypal (Beadle) on Mar 21, 2014 at 04:31 UTC | |
by Laurent_R (Canon) on Mar 21, 2014 at 07:24 UTC | |
by hazylife (Monk) on Mar 21, 2014 at 10:41 UTC |