my $tn = Net::Telnet->new(); # setup your connection here... my $tag = "___END_OF_COMMAND___".time()."_".$$; $tn->print("some command goes here ; echo $tag"); my($pre,$match) = $tn->waitfor( String => $tag ); my @output = split(/\r?\n/,$match);