M
Mike Solomon
I ran the following script and got what I consider to be a strange result
my %data;
$data{a}{a} = 1;
my $total = keys %data;
print "$total\n";
#prints 1
print "NOT IN HASH\n" unless $data{b}{b};
#prints NOT IN HASH
$total = keys %data;
print "$total\n";
#prints 2
Why does the total keys increase to 2 when I test for non existent data?
Thanks
my %data;
$data{a}{a} = 1;
my $total = keys %data;
print "$total\n";
#prints 1
print "NOT IN HASH\n" unless $data{b}{b};
#prints NOT IN HASH
$total = keys %data;
print "$total\n";
#prints 2
Why does the total keys increase to 2 when I test for non existent data?
Thanks