If so, this will work:
use Modern::Perl; while (<DATA>) { next if /^\s*case :$|^:|^struct/; print; } __DATA__ case : case : case : keep me : ignore this keep this line struct: get rid of me struct: but keep me
By the way, your regex will also ignore lines which have anything between "case" and the colon. That does not seem to conform to your requirement.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: regfular expression hlep
by CountZero
in thread regfular expression hlep
by rajans
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |