in reply to Running script only within a specific domain/network

You can use Net::CIDR to check if the IP falls within specific range(s).

#!/usr/bin/env perl use strict; use warnings; use Net::CIDR; my @ips = ('192.168.0.23', '20.30.40.50'); my @uninetworks = ('192.168.0.0/16', '10.0.0.0/8'); foreach my $ip (@ips) { if(Net::CIDR::cidrlookup($ip, @uninetworks)) { print "$ip is at university network.\n"; } else { print "$ip is unsafe!!!1!\n" } }

This results in:

192.168.0.23 is at university network. 20.30.40.50 is unsafe!!!1!

You should be able to get the list of the corresponding networks you want to check from your friendly system administrator.

Edit: Always, always use strict;

"For me, programming in Perl is like my cooking. The result may not always taste nice, but it's quick, painless and it get's food on the table."