use Lingua::EN::Sentence qw( get_sentences ); sub nsentences { my ($num, @text) = @_; my $sentences = get_sentences(join " ",@text); join " ", @{$sentences}[0..$num-1]; }