TCM has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am FTPing a file and when it gets to it's destination it cuts off at the 80th position. I need for the file to have a record length of 94, how can I change the file lenght in my perl script? I only need to change the record length for this one file, so I don't want to change any perl defaults already set up on the system. I am new to perl, and I'm not sure if this information is helpful but, I have perl v5.8.2. My script is using the Net::FTP module. Thank you for any help you can provide! - TC

Replies are listed 'Best First'.
Re: Change Record Length For FTP
by Corion (Patriarch) on Jul 28, 2010 at 14:00 UTC

    FTP has no concept of "record length", so it's not really clear to me where your problem lies. If you show the relevant code, input and output, and how the output differs from what you expect, then maybe we can help you further.

Re: Change Record Length For FTP
by Fletch (Bishop) on Jul 28, 2010 at 13:51 UTC

    It should be blatantly obvious from the code you're using which you've helpfully provided us that the problem lies on line 42.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Change Record Length For FTP
by SuicideJunkie (Vicar) on Jul 28, 2010 at 15:19 UTC

    My magic 8-ball and tea leaves disagree on the answer, but the Ouiji board says you should make sure you're transferring in Binary mode when transferring binary files between systems with different line endings.

Re: Change Record Length For FTP
by roboticus (Chancellor) on Jul 28, 2010 at 21:58 UTC

    If you're sending to a mainframe, be sure to properly set LRECL for your dataset. Another complicating factor can be the ASCII/binary/EBCDIC conversions during transmission.

    ...roboticus

      Thank you roboticus. I'm not sure how to code the LRECL in the script. Before I posted this question on PerlMonks, I tried '$newreclen = quote site lrecl=94;', but perl didn't like 'lrecl'. How do I properly set LRECL?

        If you want to send a string to the remote site, you will need to tell Perl that you mean a string:

        $ftp->quot("site lrecl=94");

        Also see Net::FTP about the quot function.