S
Shiraz
I am programing with a hash structure for a cache. The code is below.
The part dont understand, is that in the output why does "'prefix4' =>
$VAR2->{'key2'}{'key3'}{'class'}{'prefix5'}," show up unlike an array.
All the others show up as arrays but not this one. Does this mean that
i am making a wrong assignment? Is my code bad in the assignments? Or
is it just a display problem with the Data:umper module?
Thanks for any suggestions
=CODE=====================================
use strict;
use warnings;
use Data:umper;
my %acctMap=();
my @r = ( "fred", "barney", "pebbles", "bamm bamm", "dino" );
%{$acctMap{'key1'}{'key2'}{'key3'}{'class'}} = (
prefix1 => [ "george1", "jane2", "el3roy" ],
prefix2 => [ "george", "jane", "elroy" ],
prefix3 => [ "george", "jane", "elroy" ],
);
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix4'} = \@r;
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix5'} = \@r;
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix6'} = \@r;
print Dumper(%acctMap);
exit;
=CODE=====================================
=OUTPUT=====================================
$VAR1 = 'key1';
$VAR2 = {
'key2' => {
'key3' => {
'class' => {
'prefix5' => [
'fred',
'barney',
'pebbles',
'bamm
bamm',
'dino'
],
'prefix6' => $VAR2-
'george1',
'jane2',
'el3roy'
],
'prefix3' => [
'george',
'jane',
'elroy'
],
'prefix2' => [
'george',
'jane',
'elroy'
]
}
}
}
};
=OUTPUT=====================================
The part dont understand, is that in the output why does "'prefix4' =>
$VAR2->{'key2'}{'key3'}{'class'}{'prefix5'}," show up unlike an array.
All the others show up as arrays but not this one. Does this mean that
i am making a wrong assignment? Is my code bad in the assignments? Or
is it just a display problem with the Data:umper module?
Thanks for any suggestions
=CODE=====================================
use strict;
use warnings;
use Data:umper;
my %acctMap=();
my @r = ( "fred", "barney", "pebbles", "bamm bamm", "dino" );
%{$acctMap{'key1'}{'key2'}{'key3'}{'class'}} = (
prefix1 => [ "george1", "jane2", "el3roy" ],
prefix2 => [ "george", "jane", "elroy" ],
prefix3 => [ "george", "jane", "elroy" ],
);
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix4'} = \@r;
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix5'} = \@r;
$acctMap{'key1'}{'key2'}{'key3'}{'class'}{'prefix6'} = \@r;
print Dumper(%acctMap);
exit;
=CODE=====================================
=OUTPUT=====================================
$VAR1 = 'key1';
$VAR2 = {
'key2' => {
'key3' => {
'class' => {
'prefix5' => [
'fred',
'barney',
'pebbles',
'bamm
bamm',
'dino'
],
'prefix6' => $VAR2-
'prefix1' => [{'key2'}{'key3'}{'class'}{'prefix5'}, 'prefix4' => $VAR2-
{'key2'}{'key3'}{'class'}{'prefix5'},
'george1',
'jane2',
'el3roy'
],
'prefix3' => [
'george',
'jane',
'elroy'
],
'prefix2' => [
'george',
'jane',
'elroy'
]
}
}
}
};
=OUTPUT=====================================