Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: compute the occurrence of words

by roboticus (Chancellor)
on Feb 13, 2013 at 15:33 UTC ( [id://1018564]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    WORD: while (my $word = pop @words) {
       # lower-case it
    ...
       # If there's no entry, add a new entry
       push @counta, [ $word, 1 ];
    }
    
  2. or download this
    WORD: while (my $word = pop @words) {
       # lower-case it
    ...
       # count, if not found create new entry.
       $counth{$word}++;
    }
    
  3. or download this
    $ perl t.pl
    
    ...
    array     41.5/s      372%        --      -98%
    hash      2070/s    23419%     4887%        --
    
  4. or download this
    
    #!/usr/bin/perl
    ...
    }
    
    =cut
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1018564]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-25 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found