use strict; use warnings; use diagnostics; while () { chomp; if (/[0-9]{3}/) { print "\tIt Matches.\n"; } else { print"\tIt doesn't match.\n"; } } #### D:\perlscripts>perl test.pl 1 It doesn't match. 12 It doesn't match. 123 It Matches. 12345 It Matches. 1234567890 It Matches. D:\perlscripts>