in reply to How to find content between KEYWORD and BLANKLINE then print it
You can use the range operator (aka flip-flop):
while ( <$fh> ) { print if /X/ .. /^\s*$/ and not /^\s*$/; }
Edit: updated to fix a precedence problem with if ( $line =~ /X/i .. /^\s*$/ ), thanks Eily!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to find content between KEYWORD and BLANKLINE then print it
by Eily (Monsignor) on Jan 06, 2016 at 23:37 UTC | |
by johngg (Canon) on Jan 06, 2016 at 23:51 UTC | |
by choroba (Cardinal) on Jan 07, 2016 at 13:39 UTC | |
by ChrisCK (Initiate) on Jan 06, 2016 at 23:44 UTC | |
by 1nickt (Canon) on Jan 07, 2016 at 01:48 UTC | |
by johngg (Canon) on Jan 07, 2016 at 11:22 UTC |