in reply to Re^3: How to find content between KEYWORD and BLANKLINE then print it
in thread How to find content between KEYWORD and BLANKLINE then print it

You can still use a lexical but you have to be explicit about what is being matched, also taking care with the difference in precedence of and and &&. With lower precedence and:-

$ perl -Mstrict -Mwarnings -E ' open my $inFH, q{<}, \ <<EOD or die $!; Seb Xavier Peter Roland Jim Xerox Paddle Yoyo EOD while ( my $line = <$inFH> ) { print $line if $line =~ m{X} .. $line =~ m{^\s*$} and $line !~ m{^\s*$}; }' Xavier Peter Xerox Paddle $

Higher precedence && requires parentheses:-

$ perl -Mstrict -Mwarnings -E ' open my $inFH, q{<}, \ <<EOD or die $!; Seb Xavier Peter Roland Jim Xerox Paddle Yoyo EOD while ( my $line = <$inFH> ) { print $line if ( $line =~ m{X} .. $line =~ m{^\s*$} ) && $line !~ m{^\s*$}; }' Xavier Peter Xerox Paddle $

Cheers,

JohnGG