use strict; use warnings; my $str = $ARGV[0]; if ($str =~ /^[a-zA-Z0-9]{6,20}$/) { print "success!\n"; } else { print "failure\n"; }
A bit shorter.
Scott
In reply to Re: how should i test whether a string contains between 6 and 20 letters and numbers
by helphand
in thread how should i test whether a string contains between 6 and 20 letters and numbers
by keiusui
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |