Perl 使用 telnet 登录到远程服务器的代码:
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;