#!c:\\perl\\bin\\perl.exe print "Please enter your text file: "; $file = ; open FH, $file or die "ERROR You entered an incorrect file, path"; $data = ; # search file for number of occurences of words posted by perl user thinker my %count; while ( ) { $count{lc $_}++ for /\w+/g; } print "$_ = $count{$_}\n" for sort { $count{$b} <=> $count{$a} || $a cmp $b} keys %count;