in reply to Re: Bad interpreters coming out
in thread Bad interpreters coming out

Old files are .pl and .sh, the perl script created by a website which sends the .pl into the debian based system through ssh, the .sh file is generated by the system itself

the OS is a debian based OS

The ^M characters are like:

`cp /tmp/unzip/*.cfg /tmp/unzip/seed`;^M

That is just one line of the new file, ^M is all over the file everywhere

I read the file using

 open FH, "< $filename" or die "smth smth";

I wrote to the file using

 open NF, "> $filename2" or die "blabla";

I opened it using vim

Replies are listed 'Best First'.
Re^3: Bad interpreters coming out
by GrandFather (Saint) on Apr 06, 2011 at 09:33 UTC

    It seems exceedingly unlikely that a Perl script running on a *nix system using standard Perl IO would add ^M characters to files. It is much more likely that the characters exist in the original files and that those files were generated or edited on a Windows system.

    A simple test would be to create a fourth file that you write a few test lines to, then check that file for extra ^M characters. If they exist there is something weird with your build of Perl. If they don't exist then either the characters are in the source files, or you have managed to get your write file handle into a strange :crlf layer like state.

    True laziness is hard work