use strict; use Net::SSH2; my $hf = 'list.txt'; my $user = 'user'; my $pass = 'pass'; open (L,"<$hf") || die "$!"; while() { chomp $_; my $ssh = Net::SSH2->new(); $ssh->debug(1); print "Connecting now..\n"; $ssh->connect("$_") || warn "$!"; $ssh->auth_password("$user","$pass"); my $chan = $ssh->channel(); $chan->exec('dir'); $chan->close(); undef $ssh; } close L;