The salt is a random two-letter string from the set of characters allowed in a crypt string (letters, digits, slash, and dot).
It was originally designed to make it hard to have pre-compiled dictionaries of crypted words. Now that crypt is so fast, making a random salt really doesn't buy you that much safety, so just use "aa", or something boring like that.
my $crypted = crypt($password, "aa");
And no, it won't match what was originally in the file, because the odds that the salt is already "aa" is one in 512. {grin}
-- Randal L. Schwartz, Perl hacker