You have to reference the arrays first:
Because if you don't, then every array is "flattened" into one list, and the key value pairs are determined afterwards. Run this code and observe:%griph=('c' => \@c_griph, 'b' => \@b_griph, 'f' => \@f_griph, 'o' => \@o_griph, 'r' => \@r_griph, 'm' => \@m_griph, 'y' => \@y_griph, 'g' => \@g_griph, 'p' => \@p_griph, 'w' => \@w_griph);
use Data::Dumper; my @array = 1 ..5; my %hash = (a => @array, b => 'foo'); print Dumper \%hash;
So, now that you have referenced the arrays, you have to de-reference them in order to use them, like so:
print "$_\n" for @{ $griph{c} };
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Multidimensional hashes
by jeffa
in thread Multidimensional hashes
by emav
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |