I am creating a program that keeps a record of people and their sports in a .txt file and I need to make an option to remove a player. When a new player is created, their first name, last name, sport, rank and 2 line breakers are written to the text file. I need code that asks for their first name and last name and then will delete the 5 lines of their information from the text file.
$first_name = <STDIN>; chomp $first_name; $last_name = <STDIN>; chomp $last_name;
It has to search the file for a line with both of those names and then delete that line, and the one above it and 3 below it. Thanks & good luck.
In reply to Delete specific lines from txt file. by FredFredFred
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |