/m controls whether ^ and $ can match around newlines in the middle of the string. You want /s which controls whether . can match newlines. - tye (but my friends call me "Tye")if( $answer =~ /\Q$questions[$i]\E(.*?)\Q$questions[$j]\E/s ) { print qq(The answer is $1\n); }
In reply to (tye)Re2: Matching inconsistency in for loop
by tye
in thread Matching inconsistency in for loop
by Rich36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |