[Israel.pm] Help: why does it warn me?

Chanan Berler chananb at centerity.com
Wed Feb 4 06:58:00 PST 2009

Hi All,

I wrote this script:

sub update_event_log
    my ($lv_reg) = @_;

    local $lv_attemp_stmt;
    local $lv_service_stmt;
    local $lv_host_stmt;
    local $lv_hostgroup_stmt;
    local $lv_servicegroup_stmt;



The idea that sub el_parse_reg will update these fields.
I  tired doing something like that as a test (but without warnings) and it
But when I tried to imply use warnings and use strict I get this kind of
warning / error message:

Global symbol "$lv_host_stmt" requires explicit package name at event_log.pl
line 162.

Why is that?

PS: correct me if I am wrong
 But as what I understood:

my - applies to sub private variables
local - protected scalars that can be updated by other sub called by the sub
which created the local variables
our - more like a global like variables - which can be accessed from all the
module / script found on that file

More information about the Perl mailing list