use Net::SSH::Perl; $username="root"; $passwd="password"; @server = ("10.14.34.80"); my %SSH_Prm = ( "protocol" => '2', "options" => ["stricthostkeychecking no"], ); foreach $a(@server) { $ssh = Net::SSH::Perl->new($a,%SSH_Prm); $ssh->login($username, $passwd); $cmd="hostname"; my($stdout, $stderr,$exit) = $ssh->cmd("$cmd"); print "$stdout"; }