open(STDERR, ">&STDOUT"); # changes STDERR to STDOUT, lets the password thing actually work.... I think if ($METHOD eq 'telnet') { telnet_login($username, $password, $host, \$shell); # calls out to temerity_lib.pl for the generic telnet log in process. NOTE: $shell is passed by referance # perform the actions we need to accomplish $shell->print($PASSWD); # start changing the password $shell->waitfor('/password:/i') or report_error("password","No password prompt found");; # make sure it worked $shell->print($password); # send your login password my($pre,$match) = $shell->waitfor(Match => '/Incorrect password/', Match => '/New password:/'); # make sure it worked $match =~ /New/ or report_error("password","Not prompted for new password");; $shell->print($new_password); # send new password ($pre,$match) = $telnet->waitfor(Match => '/Bad password/', Match => '/Re-enter new password:/'); # make sure it worked $match =~ /Re-enter/ or report_error("password","New password rejected"); $shell->print($new_password); # send new password again $shell->waitfor('/changed/i') or report_error("password","New password rejected"); # make sure it worked $shell->close; }