|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re^2: perl one liner to search for a string, then search for a different string and append a new lineby Athanasius (Vicar) |
| on Dec 20, 2012 at 13:37 UTC ( #1009744=note: print w/ replies, xml ) | Need Help?? |
|
You need to put capturing parentheses around the text to be matched, in order to initialise $1. You should also definitely follow uncoolbob’s advice and use a non-greedy quantifier. And your code will be much easier to read if you use different delimiters, because then you won’t have to backslash all the forward slashes (“leaning toothpick syndrome”):
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||