my $last_in_sentence = sub { $content_array[$location] =~ m/\. $/s }; if(&$last_in_sentence) { ... }