I want a script to select a username. The rules for selecting a username are
The minimum length of the username is 5 characters and the maximum is 10
It should contain at least one letter from A-Z
It should contain at least one digit from 0-9
It should contain at least one character from amongst @#*=
It should not contain any spaces.
I have tried this
if ( length $passwd[$i] <= 10
&& length $passwd[$i] >= 5
&& $passwd[$i] =~ /.*\p{Lu}/
&& $passwd[$i] =~ tr/0-9//cd
&& $passwd[$i] =~ /[a-z]/ ) {
print "PASS\n";
}
else {
print "FAIL\n";
}