#!d:/perl/bin/perl -w use strict; my $username = "dave"; my $passwd = "mypass"; my $debug = "debug"; my $root = "su"; my $rootpass = "myrootpass"; use Net::Telnet (); my $t = new Net::Telnet (Timeout => 10, Dump_Log => $debug, ); $t->open("IP address here"); $t->login($username, $passwd); $t->print($root); $t->waitfor('/Password:/'); $t->print($rootpass); $t->waitfor('/#/'); my @lines = $t->cmd("whoami"); print @lines;