[ale] retrieving a file via ftp in perl

Geoffrey Myers lists at serioustechnology.com
Mon Nov 29 14:36:17 EST 2010


Mark Heiges wrote:
> 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 $_;
> }

Sweet, I'll play with it, thanks.

> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list