my $p = "howdy"; my $salt = substr($p,0, 2); #define salt however you want my $crypted = crypt($p, $salt); print "Crypted form of $p is $crypted\n";