Hi Fred,
Please, check my comments and possible solution within your mail.

On Sun, Mar 25, 2012 at 11:45 PM, hOURS <h_o...@yahoo.com> wrote:

> Hello all,
> I write CGI scripts for my website in PERL.  When I used to upload them
> with my FTP
>
  The programming language is Perl not PERL.

> program I made sure to do so in ASCII mode rather than binary.  My host
> made me switch to sFTP however.  I use FIlezilla, and can't for the life of
> me find out how to choose the mode on that.  Unfortunately, binary is the
> default mode.  I don't like programming when the file displays ASCII
> endline characters.  I'd rather see clear, distinct lines rather than one
> long line broken up with those vertical rectangles.  When I download a
> script from my site for editing it looks terrible.  So I wrote a little
> program to fix that:
>

open (NEW, '>niceviewscript.pl') or die "Couldn't open file for writing";
>
I think is better to use open() three arguments like:
open(my $fh,">",'niceviewscript.pl') or die "Couldn't open file for
writing: $!";

> open (FILE, 'script.pl') or die "Couldn't open file for reading";
>
## same thing here too

> while (<FILE>) {
>   $line = $_;
>   chomp($line);
>   print NEW "$line\n";
> }
> close (FILE); ## close($fh) or die "can't close file:$!";
> close (NEW);
>
> It works great.  How do I get it to go in reverse though so it will work
> when I upload it?  I figured out that the ASCII number for those vertical
> rectangles that represent line breaks was 10.  So I tried:
>
> $sillyrectangle = chr(10);
> open (NEW, '>workingscript.pl') or die "Couldn't open file for writing";
>
## same as above

> open (FILE, 'niceviewscript.pl') or die "Couldn't open file";
>
## same thing here

> while (<FILE>) {
>   $line = $_;
>   chomp($line);
>   $withnewend = $line . $sillyrectangle;
>   print NEW $withnewend;
> }
> close (FILE);
> close (NEW);
>
> Why doesn't this work?  The newly created file looks just like the old
> one.  Now, if anyone can tell me how to upload in ASCII mode (assuming
> that's even possible) that

 Possible Solution:
  Launch your FileZilla Program, click on the menu bar "Transfer" menu,
then check your sub-menu bar "Transfer type", you should be able to change,
your mode. I preferred to leave mine as "Auto"!

> will solve my problem even better of course.  But now I'm curious as to
> why my program for switching back doesn't work.
>
> Thank you!
> Fred




-- 
Tim

Reply via email to