#! perl use strict; use warnings; local $/ = ''; # Paragraph mode my $sentence_count = 0; my $paragraph_count = 0; my @paragraphs; while (my $paragraph = ) { my @sentences; while ($paragraph =~ m{\s*(.+?(?:\.|\?|!|$))}g) { push @sentences, "$1"; ++$sentence_count; } push @paragraphs, "

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

\n"; ++$paragraph_count; } print "\nTotal sentences: $sentence_count\n"; print "Total paragraphs: $paragraph_count\n"; print for @paragraphs; __DATA__ The quick brown fox jumped over the unfortunate dog. What a shame! She sells seashells by the sea shore. Peter Piper picked a peck of pickled peppers. Didn't he? Yes, he did. This sentence has no termination