FredFredFred has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Delete specific lines from txt file.
by roboticus (Chancellor) on Aug 07, 2012 at 02:41 UTC | |
by FredFredFred (Initiate) on Aug 07, 2012 at 23:15 UTC | |
by roboticus (Chancellor) on Aug 09, 2012 at 21:02 UTC | |
|
Re: Delete specific lines from txt file.
by NetWallah (Canon) on Aug 07, 2012 at 03:38 UTC | |
by MidLifeXis (Monsignor) on Aug 07, 2012 at 12:38 UTC | |
|
Re: Delete specific lines from txt file.
by GrandFather (Saint) on Aug 08, 2012 at 22:51 UTC | |
|
Re: Delete specific lines from txt file.
by trizen (Hermit) on Aug 07, 2012 at 07:35 UTC | |
|
Re: Delete specific lines from txt file.
by pvaldes (Chaplain) on Aug 07, 2012 at 14:57 UTC |