1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/env perl -w use strict; my $test = 'test 12 0 45'; $test =~ /(\d+)/g; pos($test) = 7; $test =~ s/\G([^\d]*)(\d+)/$1 . ($2 + 1)/e; print "$test\n";