#! usr/bin/perl use warnings; open (TEXTFILE, 'text.txt') or die ("Cannot open file : $!"); $big_string = ; $big_string = lc ($big_string); $big_string =~ s/\(|\)/ /g; @words = split (/[,.\s+]/, $big_string); foreach (@words){ push @gt_three_char_words, $_ if /[a-zA-Z]{4,}|[a-zA-Z]{3,}'/; } foreach (@gt_three_char_words) { $hash{$_}++; } foreach $key (sort {$hash{$b} <=> $hash{$a}} keys %hash) { for ($i=0; $i<=9; $i++) { print "$key\t\t= $hash{$key}\n"; }}