# untested! # a hash of IPs you want to allow my %allow = ( '127.0.0.1' => 1, '10.1.1.1' => 1, # etc ... ); unless($allow{ $ENV{REMOTE_ADDR} }) { die "Permission denied for $ENV{REMOTE_ADDR}\n"; }