in reply to Re: Retreaving N first sentences from text.
in thread Retreaving N first sentences from text.

You could use the /g regex modifier to overcome the 'only periods' assumption....
sub get_nsentences { my $text = shift; my $count = shift || 1; join '', ($text =~ /.*?[\.!?]/sg)[0..$count-1] }
This keeps the punctuation with the "sentence" so you don't have to keep track of what it was.... i.e. you can join with '', not with '.'

-Blake