my $pswd_chars = join( '', map {chr} ( 0x21 .. 0x7e )); $pswd_chars =~ s/\d+// if ( $numbers ); $pswd_chars =~ s/[A-Z]+// if ( $uppercase ); $pswd_chars =~ s/[a-z]+// if ( $lowercase ); $pswd_chars =~ s/[_\W]+//g if ( $symbols ); if ( length( $pswd_chars ) == 0 ) { push @errmsg, "\n *** You eliminated all possible characters."; } #### $pswd_chars =~ tr/1Il0O//d if ( $confusable ); #### sub GenPass { my ( $pswd_chars, $pswd_len ) = @_; my $limit = length( $pswd_chars ); my $pswd = ''; for ( 0..$pswd_len-1 ) { $pswd .= substr( $pswd_chars, rand( $limit ), 1 ); } return $pswd; }