Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: This does not look like start end

by Anonymous Monk
on Apr 10, 2018 at 08:33 UTC ( [id://1212630]=note: print w/replies, xml ) Need Help??


in reply to Re: This does not look like start end
in thread This does not look like start end

The problematic part is this one:

foreach my $subnet (($ip->bits() == 32)?@IPv4Subnets:@IPv6Subnets) { next if ($subnet eq ''); my @subnetInfo = split(/;/x, $subnet); if (Net::CIDR::cidrlookup($params{ip}, trim($subnetInfo[0]))) { return (1, \@subnetInfo); } }

I have also tried to rewrite it to while cycle with the same result.

my $number = 0; my @subnets = ($ip->bits() == 32)?@IPv4Subnets:@IPv6Subnets; while ($number < scalar @subnets) { my $subnet = @subnets[$number]; if ($subnet eq '') { $number++; next; } my @subnetInfo = split(/;/x, $subnet); if (Net::CIDR::cidrlookup($params{ip}, trim($subnetInfo[0]))) { return (1, \@subnetInfo); } else { $number++; } } return (0, "Could not find ip '$params{ip}' in subnets list");
Funnily enough the script worked when I had incorrect comparison operator ($subnet == '') in my code (with a lot of complaining from Perl of course)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found