Hey all, I'm trying to cycle through a hash and manipulate the values. If I have this situation (not the prettiest coding but hopefully you follow what I'm doing):
my %Hash; $Hash{a}[0]="i"; $Hash{a}[1]="ii"; $Hash{a}[2]="iii"; $Hash{b}[0]="iv"; $Hash{b}[1]="v"; $Hash{b}[2]="vi"; foreach my $var (sort keys %Hash) { print "$var,$Hash{$var}[0],$Hash{$var}[1],$Hash{$var}[2],"; }
The output I get is: a,i,ii,iii,b,iv,v,vi,
So for each key ($var either a or b) I have three values assigned to elements 0, 1, and 2. Can I cycle through those elements with another foreach loop and manipulate them individually without explicitly calling it with $Hash{$var}[0]? Am I doing something stupid here or too complicated and there's something easier I could do? Is this even a clear enough picture for someone to answer? :P Thanks for whatever help you can provide.
In reply to Multiple Hash values by chuckawood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |