Not super pretty, nor fast. But TIMTOWDI, as they say.my $ans = 1; my $cnt = 0; for (map {$cnt++ < 4 and $_=~/[0-9]+/ and $_ >= 0 and $_ <= 255 ? 1 : 0} split /\./, $ip) {$ans &= $_};
-Gryn
In reply to Less regex
by gryng
in thread Matching an IP address
by bort13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |