Just a data point, but an alternative way to generate the hash is to use slice assignment. It is faster than using map if %index_map is to be generated many times, e.g. across data sets.
my %index_map; @index{@array} = (0..$#array);
In reply to Re^2: How to Order an Array's Elements to Match Another Array's Element Order
by swl
in thread How to Order an Array's Elements to Match Another Array's Element Order
by ozboomer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |