[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] retrieving a file via ftp in perl
- Subject: [ale] retrieving a file via ftp in perl
- From: mheiges at gmail.com (Mark Heiges)
- Date: Mon, 29 Nov 2010 09:45:03 -0500
- In-reply-to: <[email protected]>
- References: <[email protected]>
On Nov 26, 2010, at 3:20 PM, Geoffrey Myers wrote:
> I would like to retrieve a file via perl using ftp, but I want to read
> the file into an array in perl, rather then drop it on the machine
> as a
> file. Anyone know if this is possible? I don't see such
> functionality
> with Net::FTP.
>
you can have get() send the file to an IO::Scalar handle.
my $SH = new IO::Scalar;
$ftp->get($file, $SH);
seek $SH, 0, 0;
while (<$SH>) {
print $_;
}