Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a file that I have read into a scalar and I want to delete every line that does NOT begin with two dashes (--).
Can someone tell me a trick to do that? Also, for my own learning, suppose I wanted to delete every line that does NOT begin with two dashes EXCEPT for empty lines (\n only).
Thank you for your help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: simple (in theory) regexp question
by japhy (Canon) on Apr 14, 2002 at 18:05 UTC | |
|
Re: simple (in theory) regexp question
by strat (Canon) on Apr 14, 2002 at 19:06 UTC | |
|
Re: simple (in theory) regexp question
by christina_sampson (Novice) on Apr 14, 2002 at 19:37 UTC | |
by CukiMnstr (Deacon) on Apr 14, 2002 at 20:44 UTC | |
by Juerd (Abbot) on Apr 14, 2002 at 20:50 UTC | |
by christina_sampson (Novice) on Apr 14, 2002 at 21:26 UTC | |
|
Re: simple (in theory) regexp question
by mrbbking (Hermit) on Apr 15, 2002 at 02:27 UTC | |
|
•Re: simple (in theory) regexp question
by merlyn (Sage) on Apr 15, 2002 at 14:20 UTC |