I have created a global hash and when I try to access that hash from within a Perl sub routine, it is not able to access it.
I have declared it as:
`%HASH = ();`
and trying to access it in a subroutine as :
$HASH{$key} = $value;
Am I doing something wrong?
Works fine here:
Output:
Note that under strictures you have to fully-qualify your “global” variables with their package name (
%main::truthin this case) or create a lexically scoped local name for them with our. And programming today without strictures (and warnings) is not a good thing™. In fact, activating them would have told you something useful.