Roman Daszczyszak wrote:

: In my perl script, I have a "global" variable called
: @excludedIPAddresses, declared at the top of the script using
: my.

    That sounds like a bad idea, but go on.


: When I run this, I get an error "Can't localize lexical
: variable". I understand that it's because the variable is
: declared using "my"; what I don't understand is why, or what I
: should declare the variable as, since if I leave out "my" I get
: an error using "use strict".

    Don't use local() in this circumstance.

sub ExcludeIPAddress {
    my $ipAddress = shift;
    my $subnet = shift;

    return scalar grep /$ipAddress/,
        @excludedIPAddresses,
        $subnet->broadcast(),
        $subnet->base();
}



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

Don't tread on my bandwidth. Trim your posts.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to