use Net::Telnet (); $t = new Net::Telnet (Timeout => 10, Prompt => '/bash\$ $/'); $host="10.10.10.10"; $username="xyz"; $passwd="xyz1"; $t->open($host); $t->login($username, $passwd); @lines = $t->cmd("who"); print @lines;