http://www.perlmonks.org?node_id=1018535

BigGer has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks, I am new to Perl and very unsure of using hash. Is there a way of using the code below using an array instead . I hear you ask why not just include this code and the reason is I am trying to under stand arrays at this point in my Perl journey. Also at the moment the code is returning numeric values which I need to exclude. Thanks In advance for your help G

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