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;

编程技巧