in reply to Re^2: Sorting by Array values, obtaining indices
in thread Sorting by Array values, obtaining indices

And hashes can be more efficient if there are holes in the index.
use strict; use Devel::Size qw(total_size); my %hash = ( 0 => 3, 1 => 7, 2 => 5, 3 => 0, 20202 => 2, ); my @vals = qw(3 7 5 0); $vals[20202] = 2; print 'T1: ', total_size(\%hash),"\n"; print 'T2: ', total_size(\@vals),"\n"; [waswas:/var/tmp] waswas% perl hah T1: 291 T2: 131228


-Waswas