in reply to ranged conditional with variable

You thought the second match would use $line because the first did. It didn't. You didn't provide a target for /PatternEnd/ so it bound to $_. Write it using the second example I've quoted.

# You wrote if ( $line =~ /PatternBegin/ .. $_ =~ /PatternEnd/ ) { # You wanted. if ( $line =~ /PatternBegin/ .. $line =~ /PatternEnd/ ) {

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊