http://www.perlmonks.org?node_id=344473

asinghvi has asked for the wisdom of the Perl Monks concerning the following question:

Perl gurus,
My Regular Expression String is
$PAT = '$X =~ s{^(.*?)Resolved (\d+) problems out of (\d+) picked(.*?) +$}{ (($3-$2)/$3>.5) ? 1 : 0 }se';
where
$X = "Line1\nLine2Resolved 200 problems out of 5000 picked\nLine4\nLin +e5";
When I do an eval($PAT); $X correctly gets modified to 1 or 0 depending on the digits in the string. But there is also a newline character appended to the '0' or '1'. What am I doing wrong here. I thought using 's' would let the (.*?) at the beginning and end glob all the newline characters.

Thanks for your help