use Net::Telnet (); <--some variables defined here--> $connect = new Net::Telnet (Telnetmode => 1); $connect->open(Host => $hostname, Port => $port); # For debugging print "First, login with $act\n"; print "\n"; <---snip---> print "Now for the RTRV command:\n"; print "command is $rtrv\n"; print "\n"; $connect->print("$rtrv"); (@prematch,$match) = $connect->waitfor('/COMPLD/'); while (@rlines = $connect->getlines(Timeout =>1)) { print @rlines; }