open my $file => "<", $ipfile or die "Open: $!"; my $found; while (<$file>) { next if -1 == index $_ => $remote_addr; print "Added new guest\n"; $found = 1; last; } print "Guest not found\n" unless $found; #### my $found; foreach (@ipfconts) { next if -1 == index $_ => $remote_addr; print "Added new guest\n"; $found = 1; last; } print "Guest not found\n" unless $found;