in reply to hash of arrays or separate hashes?
You would use $count = $Elementsfreq{Beta}[0] to retrieve that 40, or $count = $Elementsfreq{Alpha}[1][3] to grab that 26. The square brackets produce references to unnamed arrays.%Elementsfreq = ( 'Alpha' => [ 37, [ 0, 0, 4, 26, 0, 7 ] ], 'Beta' => [ 40, [ 1, 38, 0, 0, 0, 1 ] ], 'Gamma' => [ 3, [ 1, 1, 0, 0, 0, 1 ] ] );
Your pseudocode gave curly braces for your lists of values. Curly braces similarly produce references to unnamed hashes. If you meant them to be hashes, then replace the innermost square brackets in my example.
This is a somewhat advanced topic, but perldoc perllol should get you started with complex data structures.
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: hash of arrays or separate hashes?
by Anonymous Monk on Mar 04, 2004 at 16:05 UTC |