in reply to multiple values for one key in hash
No, but you can make the one value for a key be a reference to an array which contains multiple values.
$h{key} = [ 'value1', 'value2' ]; push @{ $h{key} }, 'value3', 'value4'; # $h{key}->[2] eq 'value3' # ${ $h{key} }[3] eq 'value4'
If you're not familiar with array references, see perlreftut for a start.
You can also make the one value for a key be a string that encodes all the various values (e.g., CSV or Data::Dumper output, etc.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple values for one key in hash
by Anonymous Monk on Apr 26, 2017 at 04:28 UTC |