use Net::Telnet. my $telnet = Net::Telnet->new(Host=>'hostname',Prompt=>'/[%#>] $/'); $telnet->open('host'); $telnet->login('user', 'Passwd'); print $telnet->cmd('who');