The crypt(3) means crypt in Section 3 of the manpages (which details libc functions). This is the same as CORE::crypt
provided by Perl. Anyway, here
is a thread detailing a previous attempt at what you are doing.
I will say here what I said there: instead of doing the hashing and writing manually, it would be better to find something more reliable on CPAN (e.g., Passwd::Unix