programming-examples/perl/Network/Telnet to a remote host.pl

19 lines
303 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use Net::Telnet;
$telnet = Net::Telnet->new
(
Timeout => 90,
Prompt => '%',
Host => 'server.com'
);
$telnet->login('username', 'password');
$telnet->cmd("cd folder1");
@listing = $telnet->cmd("ls");
print "Here are the files:\n";
print "@listing";
$telnet->close;