# From DOS prompt, give command below and leave the session open. # Version 0.60 from plink is needed because it contains the -nc # parameter. Version 0.58 did not have this parameter. The remote # host in here is the device IP address being access via telnet. # # plink.exe -L 1555:(remote host):(remote port) (ssh server) -l -pw -nc (remote host):(remote port) #!/usr/bin/perl -w use strict; use warnings; use Net::Telnet; use Data::Dumper; my $telnet = (); my @l_resp_a = (); $telnet = Net::Telnet->new( Timeout => 10, Host => 'localhost', # or 127.0.0.1 Port => 1555 ); if( $telnet ){ print "connected\n"; $telnet->prompt('//'); $telnet->cmd( String => 'ls -al', Output => \@l_resp_a ); } else{ print "failed to connect"; }