It depends if you need the password in plaintext to pass to something else. If not, you could do a one time shot with the following:
perl -le 'print crypt("your password here", "FO")'
Then in your actual script
my $password = getpassword();
if ( crypt($password, "FO") ne "crypted password from one-liner") {
#your code here
}
However, this provides a false sense of security. There's nothing that prevents someone from copying your script and changing the conditional to
if(1) {. One other caveat: don't bother picking a password that's longer than 8 characters; crypt truncates at 8 characters for historical reasons.
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come