use strict; my @list = (4,9,3); my @indicies = sort { $list[$a] <=> $list[$b] } 0 .. $#list; print "@indicies\n";