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.
Funnily enough the script worked when I had incorrect comparison operator ($subnet == '') in my code (with a lot of complaining from Perl of course)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");
In reply to Re^2: This does not look like start end
by Anonymous Monk
in thread This does not look like start end
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |