DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Check IP

02.09.2006
| 1535 views |
  • submit to reddit
        
use NetAddr::IP;
($ARGV[0] && $ARGV[1]) || die "usage: $0 Addr Range\n";
my $ip = new NetAddr::IP $ARGV[0];
$ip->within(new NetAddr::IP $ARGV[1]) ? exit 0 : exit 1;