Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The words delimited by comma after myobject are optional. There may or may not be these optional words in each line.myword myobject,option2,option3 word word word
I want to strip "myword myobject,option1,option2" from line but not know how do this e.g. something likewhile (my $line=<DATA>) { if $line =~ /^myword\s+/ { work on line; } }
I knows what first few characters of myword will be but not what myobject will be (except it's always a word).if $line =~ /^myword\s+/ { $line =~ s/^myword myobject,options//g }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remove specific data from a line
by Roy Johnson (Monsignor) on Feb 02, 2006 at 15:36 UTC | |
by Anonymous Monk on Feb 03, 2006 at 09:54 UTC | |
by Roy Johnson (Monsignor) on Feb 03, 2006 at 18:29 UTC | |
|
Re: remove specific data from a line
by idle (Friar) on Feb 02, 2006 at 15:26 UTC | |
by Anonymous Monk on Feb 02, 2006 at 15:36 UTC | |
by graff (Chancellor) on Feb 03, 2006 at 03:17 UTC | |
by Anonymous Monk on Feb 03, 2006 at 10:06 UTC |