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.
In reply to Re: Re: newline behavior in Regular Expression
by qq
in thread newline behavior in Regular Expression
by asinghvi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |