DevHeads.net

perl script prints parts of strings in the wrong order

hello,

I am trying to reuse an old perl script I wrote years ago, on an Ubuntu
16.-04LTS x86_64 box.
It behaves in a very odd way now, and I cannot figure out if it is the
code that is not
compatible with current versions of Perl, or if there is something VERY
strange happening
between the script, and the terminal it runs in.

The part of the script that works badly is this:

while (<INPUTFILE>) {
chomp;
my $LINE = $_;
many lines that "clean up" $LINE, removing certain substrings etc...

@F = split /:/, $LINE;
print "CURL:==> $F[0] ++ $CURLRES{$F[0]} ;;\n";
}

when I run it, SOME of the printed lines (say 1 every 30) have the
expected format:

CURL:==> string_a ++ string_b ;;

but all the others are like this:

;;L:==> string_c ++ string_d ;;

that is, the three initial "CUR" characters are replaced by " ;;"

It's as if something had pasted the last three characters over the first
three ones.

I have no idea what is going wrong, and why. Any help is appreciated,

TIA,

Marco