#!/usr/bin/perl $| = 1; use Net::Telnet; use strict; use CGI; use warnings; print("content-type: text/html\n\n"); my $console_server = ('TRN-13-MRV-CON-07'); my $console_mgmtA = ('2013'); my $match; my $garbage; my $output; my @array; establishing Telnet connection my $telnet = new Net::Telnet (Timeout=>10, Errmode=>'return', Port => $console_mgmtA); $telnet->open($console_server); $telnet->put(chr(13)); sleep(1); $output=$telnet->cmd('ls'); #to see what's in the string print("$output\n"); #take the string and create an array @array = split("\n",$output); #see what's in the array print @array; exit;