in reply to perl code in regex replacement

The best non-regex way?
The best way to add 10 to a number is to use +
use warnings; use strict; my $x = 123; my $y = $x + 10; print $y;
But, I suspect your example is a much-reduced version of a larger problem you are trying to solve.