TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Perl newbie - starting a telnet process...



I was trying to write a Perl script today that would telnet into a 
router, issue a few commands and then close. I wasn't having any 
luck. Can anyone tell me how to go about doing it?? Here are the 
particulars...

1) telnet
2) open xxx.xxx.xxx.xxx
3) enter_password
4) command
5) exit

Here is what my script was looking like...

#!/usr/bin/perl
open( TELNETPROC, "|telnet");
print TELNETPROC "open 192.168.0.1\n";
print TELNETPROC "thesecretpassword\n";
print TELNETPROC "clear line 1\n";
print TELNETPROC "exit\n";
close FTPPROC;

What may I be missing here?? I have the O'Reilly book 'Learing Perl' 
to help me get started with Perl, but I have not been able to pick up 
much yet.

Thanks,
Mike Glaser