At 06:14 PM 7/10/01 +0200, Jean-Pascal Dezalay wrote:
>I wrote a perl script to make a FTP connection to a remote machine like this
>
>#----------------------------------------------------------------
>#!/usr/local/bin/perl
>open (FTP, " | ftp -v -n remote.comp.fr");
>print FTP, "user username passwd\n";
>print FTP, "bin\n";
>print FTP, "prompt\n";
>print FTP, "ls . remote.list\n";
>open (LIST, "remote.list") or die "Impossible to open file"
>my @list = <LIST>
>close (LIST);
>close(FTP);
>#-----------------------------------------------------------------
>The FTP part of the script works OK. The problem occurs when I want to
>open the
>file remote.list before the close(FTP); I get "Impossible to open file"
>
>Is it necessary to close the FTP connection to be able to read the file?
>
>Any idea is welcome
What you're attempting is much harder than it needs to be. Just use
Net::FTP and it'll be easier than you had hitherto imagined. See
http://search.cpan.org/search?dist=libnet.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com