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

As documented in perlop, the flip-flop operator appends E0 to its return value for the last line, so you can exclude it directly by inspecting the value:
while (<>) { my $m = /X/ .. /^\s*$/; print if $m && $m !~ /E0$/; }
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,