in reply to cloning Sun's crypt

As lhoward pointed out, the unix (it's not exclusive to Solaris, AFAIK) crypt(1) command is more of a toy program than a serious encryption mechanism. From its man page in Solaris:
crypt implements a one-rotor machine designed along the lines of the German Enigma, but with a 256-element rotor. Methods of attack on such machines are widely known, thus crypt provides minimal security.
A publicly available program for helping in breaking ciphers generated with crypt(1) is Crypt Breaker's Workbench (cbw.tar.gz).

Also, from Bruce Schneier's "Applied Cryptography":

[crypt's] algorithm is far simpler than the World War II German Enigma and, for a skilled cryptanalyst, very easy to break.
I'm sure I could dig the algorithm out of somewhere if you are really interested in writing a Perl implementation. But if you are really interested in encrypting stuff, use some other algorithm. If you only want to play with it for a while, you could use marcos' suggestion of invoking the program from perl.

--ZZamboni