while(<>){ if(/\.\s+([A-Z]+)/){ print "$1 is capitalized\n"; } }