Help for this page

Select Code to Download


  1. or download this
    my %cars = (
      1002 => {
    ...
      12 = "Camaro",
      27 = "RSX",
    };
    
  2. or download this
    my %makes_idx = (
      1 => [1001, ... ],    # cars that are Chevys
      10 => [1002, ...],    # cars that are Acuras
      ... );
    
  3. or download this
    my %years_idx = (
      2001 => [ 1001, 1002, ... ], # cars that are 2001 models
      ... );
    
  4. or download this
    # For example, finding all 2001 or newer Chevys
    my %temp_hash = reverse %makes;         # gives the id for each make
    ...
    # search above for 2001 or newer models
    my @temp_years = grep { $_ >= 2001 } keys %years_idx;
    my @result_ids = grep { exists $make_set{$_} } @years_idx{@temp_years}
    +;