my $regex = ['(foo)',sub {\"bar$1"}]; my $string = 'blah foo blah'; $string =~ s/$regex->[0]/${(ref($regex->[1]) eq 'CODE' ? $regex->[1]-> +() : \$regex->[1])}/; print "S=$string\n";
In reply to Re^3: Regex Substitution, Interpolating on the RHS?
by Roy Johnson
in thread Regex Substitution, Interpolating on the RHS?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |