ssh2 foreach loop issue

view story

http://www.unix.com – Hello Everyone, I have the following codes that only works for the first login element. I can't get it work with the second and third login credentials. Can anyone here see the problem? I ran the code with host1, it works as expect. see below: # ./test.pl host1 Trying to connect host1... Logging in.....user1=>pass1 Login sucess But when run with host2, it fails with 3 logins, which should be passed with the second set of login credentials. See below: # ./test.pl host2 Trying to connect host2... Logging in.....user1=>pass1 Error: unable to login with user: (HowTos)