How to read the network file.
Posted
by ungalnanban
on Stack Overflow
See other posts from Stack Overflow
or by ungalnanban
Published on 2010-05-21T05:41:03Z
Indexed on
2010/05/21
6:00 UTC
Read the original article
Hit count: 223
perl
I'm using Net::FTP
for getting a remote hosted file. I want to read the file. I don't want to get the file from the remote host to my host (localhost), but I need to read the file content only. Is there any module to do this?
use strict;
use warnings;
use Data::Dumper;
use Net::FTP;
my $ftp = Net::FTP->new("192.168.8.20", Debug => 0)
or die "Cannot connect to some.host.name: $@";
$ftp->login("root",'root123')
or die "Cannot login ", $ftp->message;
$ftp->cwd("SUGUMAR")
or die "Cannot change working directory ", $ftp->message;
$ftp->get("Testing.txt")
or die "get failed ", $ftp->message;
$ftp->quit;
In the above sample program, I get the file from 192.168.8.20. Then I will read the file and do the operation. I don't want to place the file in my local system. I need to read the Testing.txt
file content.
© Stack Overflow or respective owner