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."; }