I am using the code from
How can I find and delete a line from a file? for some fantasy football stuff.
I would like know how to get verification of what was matched and deleted? So I know that only one line was removed. I would really like to match it and print what was matched in the array prior to the grep. Pardon me, I'm still a newbie at this.
use Tie::File;
use warnings;
my $file_name = 'G:\FF\myfantasyfootball.txt';
print "Enter the player's name that was drafted:";
my $player_drafted = <STDIN>;
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 "$!";
Thank you
JB