in reply to Not able to execute command in remote machine Using Net::SSH::Expect

$ssh->waitfor("Changing password for $uName.\n(current) UNIX password: ", 2) or die

According to the documentation, waitfor takes a regex as the first argument, not a string. You will need either to escape the brackets or use quotemeta or some other approach where the pattern actually matches what is returned.