Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: use of strict ....

by imp (Priest)
on Nov 05, 2006 at 18:50 UTC ( [id://582326]=note: print w/replies, xml ) Need Help??


in reply to Re^2: use of strict ....
in thread use of strict ....

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found