local $/ = ""; open $fh, $ARGV[0] or die "File $ARGV[0] not found!\n"; $scount = 0; $pcount=0; @paragraphs; while ($paragraph = <$fh>){ @sentences; while($paragraph =~ /\s*(([A-Z][A-Za-z]*)(((([A-Za-z]|[0-9])*((\'*|\-*)[A-Za-z]*))\s*(\.{3})*\!*\"*\(*\)*\,*\:*\s*)*(([A-Za-z]|[0-9])*))(\.|\?|\!))/g){ push @sentences, "$1"; $scount++; } push @paragraphs, "

\n\t" . join("\n\t", @sentences) . "\n

\n"; $pcount++; } print for @paragraphs; print "\n Total Lines: $scount\n"; print "\n Total Paragraphs: $pcount\n";