use Net::Telnet; use warnings; use strict; my ($file, $str); open $file, ">", \$str; my $t = new Net::Telnet(timeout => 10, input_log => $file, Prompt => "/\[AAUA1\]/"); $t->open("foo"); $t->login("me", "hi"); $t->cmd("pwd"); $t->cmd("whoami"); $t->close(); print "\$str content:\n"; print $str;