It doesn't matter if you use single, double, or no quotes. any of these are fine.
$ERRORS{CRITICAL}
$ERRORS{'CRITICAL'}
$ERRORS{"CRITICAL"}
The error was that you forgot the '$', so perl was treating ERRORS as a subroutine invocation, and passing the hashref {"CRITICAL" => undef} as the argument.
You can verify that behaviour like this:
use Data::Dumper;
sub ERRORS {
print "ERRORS called\n";
print Dumper(\@_);
}
$a = ERRORS{"CRITICAL"};
Which outputs:
ERRORS called
$VAR1 = [
{
'CRITICAL' => undef
}
];
By the way - in the future instead of saying "strict will puke" it would be better to provide the error.
|