my %hash = qw/name ip name2 ip2 name3 ip3/; if ( exists $hash{$name} and $ENV{REMOTE_ADDR} ne $hash{$name} ) {......