How to do same as perl's crypt?

in linux type:
$ openssl passwd ruby
get the encrypted string '2z8GoTY1O2T3A', and paste to the followed perl
script:

# test.pl
$encrypted_password = "2z8GoTY1O2T3A";
$input = $ARGV[0];
if (crypt($input,$encrypted_password) eq $encrypted_password) {
print "Correct password!\n";
}
else {
print "Access Denied\n";
}

when "perl test.pl ruby", get
Correct password!

whe "perl test.pl otherword", get
Access Denied

how to compare the input string is in accordance with the encrypted
string with ruby as same as perl?

···

--
Posted via http://www.ruby-forum.com/.

String#crypt

···

--
Posted via http://www.ruby-forum.com/.