Hi,
I'm working on a complex data structure with hashes of hashes and
hashes of arrays and I noticed a weird behavior I was hoping someone
could explain.  Here's a sample:

$Data{US17}{1}{GROUP} = "STRING";
$Data{US17}{1}{GROUP}{.001} = 5;
$Data{US17}{1}{GROUP}{.002} = 6;
$Data{US17}{1}{GROUP}{.003} = 7;
print "group = $Data{US17}{1}{GROUP}\n";
for my $time (keys %{$Data{US17}{1}{GROUP}}){
 print "time = $time   $Data{US17}{1}{GROUP}{$time}\n";
 }

The output is:
group = STRING
time = 0.002   6
time = 0.003   7
time = 0.001   5

If I swap the order of the declarations, then all of the keys for the
hash under 'GROUP' are wiped out.  For example:
$Data{US17}{1}{GROUP}{.001} = 5;
$Data{US17}{1}{GROUP}{.002} = 6;
$Data{US17}{1}{GROUP}{.003} = 7;
$Data{US17}{1}{GROUP} = "STRING";

only produces:
group = STRING

Is this expected behavior?  Am I getting lucky in the first instance
with bad syntax that just happens to do what I want?

Thanks in advance,
Jason

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to