use Tie::File; use warnings; my $file_name = 'G:\FF\myfantasyfootball.txt'; print "Enter the player's name that was drafted:"; my $player_drafted = ; chomp $player_drafted; print "Player is: '$player_drafted' \n"; # open the file with tie tie my @file_lines, 'Tie::File', $file_name or die; # filter out lines containing from user input @file_lines = grep { !/$player_drafted/i } @file_lines; #print @file_lines; # close the file with untie. # IMPORTANT: always untie when you are done! untie @file_lines or die "$!";