use Modern::Perl; use Lingua::EN::Sentence qw( get_sentences ); my ( $LRS, %seen ) = ''; my $sentences = 'Mr. Cat jumped over the dog. Smart Mr. Cat! He jumped over the dog. Mr. Cat jumped over the dog.'; map { $seen{$_}++ and length $_ > length $LRS and $LRS = $_ } @{ get_sentences($sentences) }; say $LRS;