Help for this page

Select Code to Download


  1. or download this
    my %h;
    @h{@array_b} = @array_a;
    ...
    for (sort {$a <=> $b} keys %h) {
      print "$_: $h{$_}\n";
    }
    
  2. or download this
    my @sorted_values;
    @sorted_values[@array_b] = @array_a; # magically sorted!
    
  3. or download this
    # same as above, then
    @sorted_values = grep defined, @sorted_values;