#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH::Parallel; my @hosts=('192.168.0.19','192.168.0.18'); my $pssh = Net::OpenSSH::Parallel->new(); sub task() { print "Hi\n"; } foreach my $host ( @hosts ) { $pssh->add_host($host,user =>'root',passwd=>'access',on_error=>($pssh, $host, 'OSSH_ON_ERROR_IGNORE',task())); } my $path='/tmp/a.txt'; my $destination='/tmp/a.txt'; $pssh->push('*', scp_put => $path, $destination) or print "UNABLE to PUSH"; $pssh->run or print "RUN FAILED"; #### [root@station182 Perl]# perl SSH_Parallel.pl Hi Hi