#!/usr/bin/perl -w use Net::OpenSSH; use strict; use warnings; #connection: my $ssh2convey99 = Net::OpenSSH->new('...'); $ssh2convey99->error and die "Couldn't establish SSH connection: ". $ssh2convey99->error; #get some date from remote host and fill array my @ls = $ssh2convey99->capture("disptest | grep -E ' 900 ' | grep -v 1900 | grep -E -v '0 RE' | grep -E -v '0 WE' | grep -E -v '0 WAV' | grep -E -v '0 WA' | awk '{print \$3\";\", \$6\";\" }'"); $ssh2convey99->error and die "remote ls command failed: " . $ssh2convey99->error; # include variables and arrays for data preparation my @split_array; my @matrix_array; my $mitzl = 0; # prepare the data an store in the matrix foreach my $el (@ls){ $mitzl ++; @split_array = split(/;/,$el); $matrix_array[$mitzl] = [@split_array]; } #including variables and arrays for getting the needed data for all list elements my @bt; my @bt_matrix_array; my $length_matrix_array = @matrix_array; #running thru the list and send commando to remote host for every element. #store all input in new matrix for(my $i = 2;$i <= $length_matrix_array;$i++) { @bt = $ssh2convey99->capture("bt $matrix_array[$i][0]"); $bt_matrix_array[$i-1]=[@bt]; }