$chan->shell(); print $chan "ssh -l username 10.1.1.1\n"; while($buf=<$chan>){ if($buf =~ /"password:"/) { print $chan "password\n"; # got password prompt} else { exit; # export debug info, not reachable etc } } # # Once SSH into cisco switches, process cisco commands here # The actually commands are input from a separate file, # this is just an example. # print $chan "show tech\n"; print $chan "show version\n";