## Connect and login. use Net::Telnet (); use Getopt::Long; my ($opt_help, $hostname, $user, $password, $commande ); if (@ARGV > 0) { GetOptions("s=s" => \$hostname, "u=s" => \$user, "p=s" => \$password, "c=s" => \$commande, "help|h|?" => \$opt_help ) or die "$!\n"; } else { $opt_help = 1; } if (defined $opt_help) { print < -u -p -C | -{h,help,?} EOF exit; } $host = new Net::Telnet (Timeout => 30, Prompt => '/terminal/'); #$fh = $host->dump_log("log.txt"); $host->open($hostname); $host->login("$user", "$password"); $host->prompt("/$hostname #/i"); @line= $host->cmd("INFB"); #$host->prompt("/$hostname #/i"); @line= $host->cmd("$commande"); print STDOUT @line; $host->close;