Hi all, I'm using windows machine and i'm using Net::SSH2 module to connect to remote machine below is the code i'm using, its working fine if i'm connecting to one host #!/usr/bin/perl -w use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect("hostname") or die "Unable to connect host $@ \n"; $ssh2->auth_password('<username>','<password>'); my $chan = $ssh2->channel(); $chan->exec('ls -al'); my $buflen = 10000; my $buf1 = '0' x $buflen; $chan->read($buf1, $buflen); print "BUF1:\n", $buf1,"\n"; $chan->exec('exit'); $ssh2->disconnect(); How can i use the same piece of code to read a list of hosts from a text file and then connect to all the hosts in that text file.....I tried the below code but its not working....can somebody please help me with this. #!/usr/bin/perl -w use strict; use Net::SSH2; open INPUT, "< input.txt" while (<INPUT>) { my $ssh2 = Net::SSH2->new(); $ssh2->connect("$_") or die "Unable to connect host $@ \n"; $ssh2->auth_password('<username>','<password>'); my $chan = $ssh2->channel(); $chan->exec('ls -al'); my $buflen = 10000; my $buf1 = '0' x $buflen; $chan->read($buf1, $buflen); print "BUF1:\n", $buf1,"\n"; $chan->exec('exit'); $ssh2->disconnect(); }Thread Next