The problem right now is, although I can get access to the arrays again if I access a specific value with a specific key, I can't get access when I just try keys() to start out. E.g.my @multiKey1 = ("a","b"); my @stuff1 = ("1", "2", "3"); my @multiKey2 = ("c","d"); my @stuff2 = ("4", "5"); my @multiKey3 = ("e","f"); my @stuff3 = ("6", "7"); my %testHash = ( \@multiKey1 => \@stuff1, \@multiKey2 => \@stuff2, \@m +ultiKey3 => \@stuff3);
For this, I get the following output, and I don't understand why :-/@testHashKeys = keys %testHash; @testHashValues = values %testHash; $tmp = @testHashKeys; foreach (@testHashKeys){ print "deref bla = @$_ = $_\n"; } foreach (@testHashValues){ print "deref bla = @$_ = $_\n"; } $ref = $testHash{$testHashKeys[0]}; @valueArray = @$ref; print "valueArray = @valueArray\n";
The key thing is the line: print "deref bla = @$_ = $_\n"; If it knows that $_ is an array reference, why doesn't @$_ dereference it to give me the array values printed out, like everywhere says it should, and like happens with the values array? I greatly appreciate you taking the time to read this :)deref bla = = ARRAY(0x10082add0) deref bla = = ARRAY(0x10082afc8) deref bla = = ARRAY(0x10082aed8) deref bla = 1 2 3 = ARRAY(0x10082ae48) deref bla = 6 7 = ARRAY(0x10082b040) deref bla = 4 5 = ARRAY(0x10082af50) valueArray = 1 2 3
In reply to reference as hash keys and values by ChangeManagement
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |