in reply to Leading zero's, and their persistance

You code has only two print statements, but your output shows three lines; it's a little unclear whether you've inadvertantly omitted another print statement.

However, presuming that the missing code looks like these two lines:

$v += $v; print "$v\n";

I may have an explanation.

Which is, the increment and decrement operators, in particular, can be used to increment strings. In other words, they are not strictly numeric operations.

my $x = 'A'; ++$x; print "$x\n";

would print

B

So, changing the ++ to += 1 in your example produces different results.

use warnings; use strict; my $v = 99; $v = sprintf( "%04d", $v ); print "$v\n"; $v += 1; print "$v\n"; $v += $v; print "$v\n";
prints:
0099 100 200

dmm

You can give a man a fish and feed him for a day ...
Or, you can
teach him to fish and feed him for a lifetime