#!/usr/bin/perl -w use strict; use Net::Telnet; my $username = "user"; my $password = "password"; my $host = "localhost"; my $telnet = new Net::Telnet ('Timeout'=>'7', 'Prompt'=> '/.*([\$#\%>~]|\\\[\\e\[0m\\\] \[0m)\s?/' ); ; my $shiznat = "default value"; $telnet->open(Host=>$host); $telnet->login($username,$password); $telnet->dump_log("loging.log.log"); $telnet->cmd('String' => "/bin/echo \\\$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat; $telnet->cmd('String' => "/bin/echo \$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat; #### stuff stuff