[lug] filehandles in perl question...

arnie asherman1 at uswest.net
Fri Jul 28 13:26:13 MDT 2000


Hi,
I have been working on a perl script to telnet to a remote server and
append the contents of a log file into another file. I am using the
Net::Telnet module to connect to the server and cd to the proper
directory. I then try to open a filehandle to read the logfile, and
another to write to w/ the following syntax:

open (IN,  "< logfile");
open (OUT, ">> newlogs.txt");
system("cat logfile >> newlogs.txt");
close IN;
close OUT;

The problem I seem to be having is that the filehandles are opening on
the local filesystem. I get an error that logfile cannot be opened, and
a zero k newlogs.txt file on the local filesystem. What I'd like to do
is read and write on the remote machine, and then I will retrieve the
file by FTP.

I can do things like ls and pwd on the remote machine, but cannot seem
to figure out how to read &  append the remote file. I have tried using
the filehandles IN & OUT as well as the actual filenames as shown above,
w/ no luck. Any suggestions will be greatly appreciated.
thanks
--
arnie sherman
frenomulax at bigfoot.com

"I'm only Bob Dylan when I have to be."
  - Bob Dylan






More information about the LUG mailing list