My apologies you were right. I misunderstood the question. Yves On Thu, 9 Jan 2020, 09:39 demerphq, <demer...@gmail.com> wrote:
> On Thu, 9 Jan 2020 at 05:49, Joseph He <joseph.he.2...@gmail.com> wrote: > > > > I think $str =~ /(\d+)\s(\d+)\s(??{$1*$2})/ should do it > > My Perl version is v5.26.1 > > I think you mean (??{ "$1*$2"}) which might work, but it will be error > prone, (??{"(?$1)*$2") would be better, but both will be slow, as each > time a new pattern willbe compiled. > > /(\d+)\s(\d+)\s(\1*\2)/ > > just works, and does not recompile the pattern over and over. Look for > "back references" in perlre. > > Yves >