I would like to match exactly 6 digit if user inputs from the command line. The following code I used, but if I go for more than 6 digits its getting fail, I am getting Exact match. Can anyone look into this ======================= 6 digit - Exact match expect that should display Not Correct ================= $d=$ARGV[0]; if($d =~ m/\d{6}/) { print "Exact match\n"; } else { print "Not Correct\n"; }