foreach $sentence(@sentences) {
$total_sentence +=1;
@words = split(/[^\w'a-zA-Z0-9_'-?]+/,$sentence);
$Counter =0;
foreach $word(@words){
$Counter+=1;
}
$sentence_count{($Counter)}=$sentence_count{($Counter)}+1;
}
sort {$a<=>$b} (keys (%sentence_count));
print ("\nThere are a total of $total_sentence sentences in this text\n");
while (($sentence_count,$word_count) = each(%sentence_count)) {
print ("\nThere are $sentence_count sentences of $word_count words\n");
}