Better yet, for a recent enough perl, use a lexical variable to hold the filehandle. It'll look cleaner.$ftp->put(\*TR,$File);
open my($tr), "unix2dos $File |" or die $!; # Or FQ path $ftp->binary(); # We translate, not the server. $ftp->put($tr,$File); # must give remote name.
But, IMO, it's overkill to call an external program to handle this little task. Perl will convert line endings for you, when reading from a handle in text mode. Internally, on Windows, text data is Unix text data. So, all you need to do is open the file.
open my($fh), $File or die $!; $ftp->binary(); # We translate, not the server. $ftp->put($fh,$File); # must give remote name.
p.s. I really wonder why just transferring data in Ascii mode won't work. Are you sure you don't accidently have double carriage returns in your files?
In reply to Re^3: convert files unix2dos using perl script
by bart
in thread convert files unix2dos using perl script
by cc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |