[Israel.pm] Help: why does it warn me?
chananb at centerity.com
Wed Feb 4 07:35:43 PST 2009
Thanks for the help,
Using the array as return might work for me....more cleaner and next time I
will look at it, it will pop right off
Using hash although will work for me, it will be hard to understand
But thanks I will take ur advice
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Gabor Szabo
Sent: Wednesday, February 04, 2009 5:32 PM
To: Perl in Israel
Subject: Re: [Israel.pm] Help: why does it warn me?
why not write:
my ($lv_reg) = @_;
my ( $lv_attemp_stmt, $lv_service_stmt, $lv_host_stmt,
$lv_hostgroup_stmt, $lv_servicegroup_stmt) =
and let the _el_parse_reg_() return the values?
or even cleaner
my ($lv_reg) = @_;
my %lv = _el_parse_reg_($lv_reg);
attemp, service, host, hostgroup and servicegroup be the keys of that
You should nearly never use anything else than "my".
On Wed, Feb 4, 2009 at 4:58 PM, Chanan Berler <chananb at centerity.com> wrote:
> 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
> 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
> which created the local variables
> our - more like a global like variables - which can be accessed from all
> module / script found on that file
Perl mailing list
Perl at perl.org.il
More information about the Perl