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

Re: better array to hash conversion

by Anonymous Monk
on Dec 11, 2012 at 15:14 UTC ( #1008321=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $hash{ $array[$_] } = $_ for (0..$#array);
    
  2. or download this
    use 5.012;
    while (my ($idx, $val) = each(@array)) {
      $hash{$val} = $idx;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-09-19 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls