foreach $up(@hosts) { chomp($up); my $user = "user"; # your account my $ssh2 = Net::SSH2->new(); $ssh2->debug(0); $ssh2->connect($up) or die "Unable to connect host $@ \n"; $ssh2->auth_password($user,$passwd); my $chan = $ssh2->channel(); $chan->exec('sh ver bri'); my $buflen = 3000; my $buf1 = '0' x $buflen; $chan->read($buf1, $buflen); print $up, $buf1; }