my $found; open IPFILE, "< $ipfile" or die "couldn't read $ipfile: $!"; while () { last if $found = /\Q$remote_addr\E/o; } close IPFILE; if ($found) { print "user found!\n" } else { print "user not found!\n" }