#!/usr/bin/perl -w my (@ipfconts, $ipfile, $x); $remote_addr = '63.103.135.132'; $ipfile = '../ipfile.txt'; open (IPFILE, "<$ipfile") || die("Could not open $ipfile: $!\n"); @ipfconts = ; for ($x=0; $x<=$#ipfconts; $x++) { if ($ipfconts[$x] =~/$remote_addr}/){ print "added new guest!\n"; last; }else{ print "guest not found!\n";last; } }