use strict; use warnings; while () { if (/['.]{2,}/) { print "Rejected: $_"; } else { print "Accepted: $_"; } } __DATA__ St.John's high school. A. B. C. school. Institute of management. oxford university. A.B.C college. Ragu ram's college of technology. A..B.C college. St.John''s high school. St.John'.'s high school.