in reply to Strings overwrite themselves in print command
What hippo said. It's quite easy to exemplify this effect:
c:\@Work\Perl>perl -wMstrict -le "my $overwrite = qq{AAAAA\rbbbb\rCCC\rdd\rE}; print $overwrite; " EdCbA
Update: I would say the problem is likely not so much with leading or trailing carriage returns as with embedded \r characters as in the example.
Give a man a fish: <%-{-{-{-<
|
|---|