in reply to Hash sort again!!
well.. your major problem is probably that you are just using sort by itself,
as though it will make your hash sorted, it won't. sort returns you a list
of your sorted keys so you want
- Ant
try this...foreach (sort keys %sentance_count)
$total_sentence = @sentances; foreach $sentence (@sentences) { $count = scalar (split(/[^\w'a-zA-Z0-9_'-?]+/,$sentence)); $sentence_count{$count}++; } print ("\nThere are a total of $total_sentence sentences in this text\ +n"); foreach(keys %sentence_count) { print ("\nThere are $_ sentences of $sentence_count{$_} words\n"); }
- Ant
|
---|
In Section
Seekers of Perl Wisdom