}
my $quote = 1;
my $extended = ($op->pmflags & PMf_EXTENDED);
+ my $rhs_bound_to_defsv;
if (null $kid) {
my $unbacked = re_unback($op->precomp);
if ($extended) {
carp("found ".$kid->name." where regcomp expected");
} else {
($re, $quote) = $self->regcomp($kid, 21, $extended);
+ $rhs_bound_to_defsv = 1 if $kid->first->first->flags & OPf_SPECIAL;
}
my $flags = "";
$flags .= "c" if $op->pmflags & PMf_CONTINUE;
}
$re = $re . $flags if $quote;
if ($binop) {
- return $self->maybe_parens("$var =~ $re", $cx, 20);
+ return
+ $self->maybe_parens(
+ $rhs_bound_to_defsv
+ ? "$var =~ (\$_ =~ $re)"
+ : "$var =~ $re",
+ $cx, 20
+ );
} else {
return $re;
}
require feature;
feature->import(':5.10');
}
-use Test::More tests => 89;
+use Test::More tests => 90;
use Config ();
use B::Deparse;
pop();
####
pop @_;
+####
+# 82 [perl #20444]
+"foo" =~ (1 ? /foo/ : /bar/);
+"foo" =~ (1 ? y/foo// : /bar/);
+"foo" =~ (1 ? s/foo// : /bar/);
+>>>>
+'foo' =~ ($_ =~ /foo/);
+'foo' =~ ($_ =~ tr/fo//);
+'foo' =~ ($_ =~ s/foo//);