or use sprintf. Search for "format parameter index" if you need to rearrange or repeat the ordering of the matches in the output.
sub foo { my ($from, $to) = @_; return sprintf($to, ($from =~ /.../)); }
--MidLifeXis
In reply to Re: Interpolate $1 in: s{...}{$to}
by MidLifeXis
in thread Interpolate $1 in: s{...}{$to}
by perl5ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |