use File::Slurp; my $s = read_file("test.xml"); $s =~ s/()(\d+)()/$1.($2 + 10).$3/eg; write_file("test.xml",$s);