I am trying to use a hash of hashes like this -
#!/usr/bin/perl -w
use strict;
my %hash = ();
sub hash_populate
{
my $name = "PQR,ABD,XYZ";
my @parts = split(/,/,$name);
my $i = $parts[0];
my $a= $parts[1];
my $b = $parts[2];
$hash{$i} = {"A" =>$a,"B" => $b};
my $c = $hash{$i}{"A"};
print $c;
}
I get an error of the form
Can't use string ("HASH(0x16c43c)") as a HASH ref while "strict refs" in use
The same code works when use strict
is not present. Can someone tell me why?