Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: This does not look like start end

by Anonymous Monk
on Apr 10, 2018 at 08:33 UTC ( #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
Node Status?
node history
Node Type: note [id://1212630]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2020-09-30 01:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (156 votes). Check out past polls.

    Notices?