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


in reply to Re: newline behavior in Regular Expression
in thread newline behavior in Regular Expression

I agree, eval seems unneeded here. You can still use s///, although I would prefer it like yours.

#!/usr/bin/perl my $x = "Line1\nLine2Resolved 200 problems out of 5000 picked\nLine4\n +Line5"; $x =~ s/.*?Resolved (\d+) problems out of (\d+) picked.*/ ($2 - ($1\/$2)) > .5 ? 1 : 0 /es; print "$x\n";

Remember to escape the division in the substitution.

qq