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/ ) {
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: ranged conditional with variable
by diotalevi
in thread ranged conditional with variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |