in reply to Convert binary to ascii while sftp using Net::SSH2

tsandras:

The file is likely not being converted. On windows, the end-of-line convention is \r\n, while on unix, it's \n. So when you copy a windows text file to unix, you will normally have files with a carriage return (\r == ^M) at the end of your lines. That's the reason we have programs like dos2unix. If you're going to process the file in a perl program, though, I generally skip the dos2unix, and instead use something like:

while (<$FH>) { # Remove *all* whitespace from the end of the line s/\s+$//; . . . the stuff you're gonna do anyway }

...roboticus

When your only tool is a hammer, all problems look like your thumb.