in reply to mutiple array as hash value per key
The values in a hash can be any kind of scalar. To get the results that you want, each value would need to be a reference to an array, and each element in the referenced arrays would need to be another array reference.
%number = ( 23 => [ [ 'g1', 23, 24 ], [ 'g2', 34, 35 ] ], 24 => [ [ 'g3', 45, 56 ], [ 'g4', 36, 48 ] ], ); $grp = $number{23}[0][0];
Note the I've corrected your hash-creating brackets from {} to ().
For more details see perldsc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: mutiple array as hash value per key
by Anonymous Monk on Jul 02, 2009 at 06:44 UTC | |
by davorg (Chancellor) on Jul 02, 2009 at 07:36 UTC |