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 browsing the Monastery: (8)
As of 2014-07-12 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls