Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: array => hash of occurrence indexes

by kcott (Abbot)
on Sep 12, 2013 at 05:19 UTC ( #1053646=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub occurences {                                                    
        my %h;          
    ...
        push @{$h{$_}}, $i++ for @_;
        return \%h;
    }
    
  2. or download this
    sub occurences { my ($i, %h) = 0; push @{$h{$_}}, $i++ for @_; \%h }
    
  3. or download this
    $ perl -Mstrict -Mwarnings -e '
        use Data::Dumper;
    ...
                       7
                     ]
            };
    
  4. or download this
    $ perl -Mstrict -Mwarnings -e '
        use Data::Dumper;
    ...
                       4
                     ]
            };
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-07-28 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls