http://qs1969.pair.com?node_id=582320


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

Than why would it work if I took the "use strict" pragma out? BTW, it's a typal, it should be "CRITICAL". I took a look at utils.pm, it's a hash, not a method. To clarify, you saying I should use single qoute:
exit $ERRORS{'CRITICAL'};
instead of double qoute:
exit $ERRORS{"CRITICAL"};
because it intrepret the double qoute as:
$CRITICAL->ERRORS();

Replies are listed 'Best First'.
Re^3: use of strict ....
by imp (Priest) on Nov 05, 2006 at 18:50 UTC
    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.