#!C:/perl/bin -w # sentence.pl use strict; use vars qw( $sentence @sentence ); while ( ) { print "\n<$_>\n\n"; @sentence = split /\.{1,4}\s+/, $_; # push @sentences, $first; for $sentence( @sentence ) { print "\t-$sentence-\n"; } } __DATA__ This is a sentence. This is another. There were two spaces before this sentence. This is the first and only sentence of a new paragraph... but it's a long one. This sentence has commas, thusly, and, for good measure -- dashes -- thusly. End of test data. #### -This is a sentence.- -This is another.- -There were two spaces before this sentence.- -This is the first and only sentence of a new paragraph.- -but it's a long one.- -This sentence has commas, thusly, and, for good measure -- dashes -- thusly.- -End of test data.- #### -This is a sentence.- -This is another.- -There were two spaces before this sentence.- -This is the first and only sentence of a new paragraph.- -but it's a long one.- -This sentence has commas, thusly, and, for good measure -- dashes -- thusly.- -End of simple test data.- -Begin simple data with html entities.
.- -This is a sentence separated from the following sentence by two spaces, one of them an html entity.- - And this is another.- -While this might appear at the end of a paragraph.</p> .- -<p>And so on.</p> .-