in reply to Re: Retreaving N first sentences from text.
in thread Retreaving N first sentences from text.
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 '.'sub get_nsentences { my $text = shift; my $count = shift || 1; join '', ($text =~ /.*?[\.!?]/sg)[0..$count-1] }
-Blake
|
|---|