Monolith-0 has asked for the wisdom of the Perl Monks concerning the following question:
I want to get the sorted order of a list of values, but not change the original list.
I have an index array in which I wish keep track of the values' sorted order.
For example... start with:
then sort and get:@stuff_list = ( 'b','t','e','s','u','i' ); @list_order = ( 0 , 1 , 2 , 3 , 4 , 5 );
And then use @list_order to access the actual values.@stuff_list = ( 'b','t','e','s','u','i' ); @list_order = ( 0 , 2 , 5 , 3 , 1 , 4 );
Originally posted as a Categorized Question.
Back to
Seekers of Perl Wisdom