my $ipFound; my $count = 0; print "Which file among the following files do you want to check ? \n"; my $directory = '/home/psimo/it441/challenge/logs'; opendir (DIR, $directory) or die $!; while ( my $file = readdir(DIR) ) { print " $file \n"; } print "Please enter the file name: "; my $theFile = ; chomp ($theFile); open READ, '<', "$directory/$theFile" or die "CAN'T OPEN FILE! The file name entered does not exist\n"; while(){ if(/POSSIBLE BREAK-IN ATTEMPT!/){ if(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/){ $ipFound = $1; print $_; $count++; } } } print " There are $count break-in attempts ";