in reply to Selecting Password

While you could jump through hoops to escape certain characters in your password from within Perl and the shell and echo, I would probably look for a ready-made solution instead such as Authen::PAM. See eg. Can I change a password non-interactively? from the FAQ there.