Hello, I have the following issue (i.e, i am not sure how to implement the thing that I need).
I have a file "test.txt" containing the following two lnes:
vc66, 17 Almond Close Whitstable Kent, vc66@canterbury.ac.uk, 0128, ac
+398, 18/09/2010, 09/03/2012
lb348, 42 Alicia Avenue Dover Kent, lb348@canterbury.ac.uk, 0723, ac39
+8, 02/02/2007, 01/03/2010
What i have to do is the following:
The program will ask the user for the username that they want to delete. Username is first item in each row (vc66, lb348).
Next, the system will delete the whole row depending on the username that the user enters.
For example, if I enter lb348, the program should delete second row and leave only first row in the file.
What I was thinking to do here:
Send every line to an array. My array will contain two lines. Next, I assume I could use grep function for deleting row. But I am confused about how to implement all this.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.