if ($value !~ /^(-)*\d{2}$/) { print "input contains more than two digit"; }