Can't use string ("key bar's value") as a HASH ref while "strict refs"
####
#!/usr/bin/perl
use strict;
use warnings;
my %foo;
if(exists($foo{qux})) {
print "\$foo{qux} exists";
}
if(ref $foo{bar} eq 'HASH' && exists($foo{bar}{baz})) {
print "\$foo{bar}{baz} exists\n";
}
if(exists($foo{bar})) {
print "\$foo{bar} popped into existence\n";
}
##
##
#!/usr/bin/perl
use strict;
use warnings;
my %foo;
$foo{bar} = "key bar's value";
if(exists($foo{qux})) {
print "\$foo{qux} exists";
}
if(ref $foo{bar} eq 'HASH' && exists($foo{bar}{baz})) {
print "\$foo{bar}{baz} exists\n";
}
if(exists($foo{bar})) {
print "\$foo{bar} popped into existence\n";
}
##
##
#!/usr/bin/perl
use strict;
use warnings;
my %foo;
$foo{bar} = "key bar's value";
if(exists($foo{qux})) {
print "\$foo{qux} exists";
}
if(exists($foo{bar}) && exists($foo{bar}{baz})) {
print "\$foo{bar}{baz} exists\n";
}
if(exists($foo{bar})) {
print "\$foo{bar} popped into existence\n";
}