#!/usr/bin/perl5.8.0 use strict; use warnings; use Term::ReadKey; $|++; $SIG{INT} = sub { ReadMode 0; exit; }; my @chars = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9); my $crypt = '$1$'; for (1..8) { $crypt .= $chars[ int rand @chars ]; } ReadMode 2; print "passwd: "; my $pw = ; print "\nrepeat: "; my $rep_pw = ; ReadMode 0; print "\n"; if ( $pw eq $rep_pw ) { print crypt( $pw, $crypt),"\n"; } else { print "\npasswords don't match.\n"; }