use Net::OpenSSH::Parallel; my $pssh = Net::OpenSSH::Parallel; $pssh->add_host($_, user => $user, password => $password) for @hosts; $pssh->all(parsub => \&query_device); $pssh->run; sub query_device { my ($host, $ssh) = @_; my $output = $ssh->capture({ stdin_data => < 1 }); enable $secret term len 0; sh mls cef sum EOD $output =~ s/\s+/ /g; print "data from $host: $output\n"; }