in reply to Print 4 Lines below matching criteria

m/ \nid: # match new line followed by id: [^\n]* # 0 or more characters that are not new lines \n # a newline ([^\n]*\n){4}) # the next 4 lines and store in $1 /sx; # treat as a '(s)ingle line' and (x) ignore whitesp +ace
edit - I was sober too - omg, back to Idiocy for Dummies...

Replies are listed 'Best First'.
Re^2: Print 4 Lines below matching criteria
by ikegami (Patriarch) on Nov 16, 2006 at 05:56 UTC

    Oops, you forgot to negate your character classes! Also, the s option is useless because . wasn't used.

    m/ \n id: # Match new line followed by id: [^\n]* # 0 or more characters that are not new lines \n # A newline ([^\n]*\n){4}) # The next 4 lines and store in $1 /x; # Ignore whitespace