Though I agree with arden, I don't think it will cause any harm to give you a hint to start off with. This node on Perlmonks suggests the use of the Crypt::GeneratePassword module available from CPAN. Once you've learned some Perl, I think you'll find it easy to incorporate in your code. As for learning Perl itself, you should get a book, but meanwhile the Tutorials may be a good place to start.