Help for this page

Select Code to Download


  1. or download this
    my ($idx, @array, $a_big_num, $some_data);
    
    ...
    # Fetch the data
    $idx = map_func($a_big_num);
    $some_data = $array[$idx];
    
  2. or download this
    my (%hash, $a_big_num, $some_data);
    
    ...
    
    # Fetch
    $some_data = $hash{$a_big_num};
    
  3. or download this
    sub map_func { return 7 }
    
  4. or download this
    sub map_func {
       state %indexes;
    ...
       die "Ran out of slots!" if keys %indexes > 1000;
       return $indexes{$a_big_num}=$idx++;
    }