sub mkpasswd { srand(time|$$); $random = "abcdefghijklmnopqrstuvwxyz1234567890"; for (1..2) { $salt .= substr($random,int(rand(36)),1); } return crypt (@_, $salt); } open(PWD,">>/some/file/used/for/apache/auth.txt"); print PWD "@ARGV[0]:" . mkpasswd(@ARGV[1]) . "\n"; close(PWD);