more useful options | |
PerlMonks |
Re: Removing matched pattern except the first patternby RMGir (Prior) |
on May 28, 2013 at 12:11 UTC ( [id://1035578]=note: print w/replies, xml ) | Need Help?? |
You're asking a strange question... Why use a pattern to do this at all?
In this case, you want to capture everything from line 3 onwards, so why not use the $. variable which captures the line #, and save all the lines where $.>2? Or just use a variable to count the lines and save lines based on the counter value? If you HAVE to do this with a regex for the lines to exclude, you still don't need to count anything - just exclude anything matching /procs|swpd/ for example... Mike
In Section
Seekers of Perl Wisdom
|
|