in reply to Replacing matches within string without splitting.
A variation on the sprintf solutions using split, map and join.
$ perl -E ' > say join q{,}, map { sprintf q{%02d}, $_ } split m{,} for qw{ > 1,2,3,4 > 8,9,10,11 > 7,8,9,10 > 12,13,14,15 > };' 01,02,03,04 08,09,10,11 07,08,09,10 12,13,14,15
I hope this is of interest.
Cheers,
JohnGG
In Section
Seekers of Perl Wisdom