in reply to Sorting arrays and maintaining an index

You could do the following...
for(my $i = 0; $i <= $#Sort_by; $i++) { push @{$sort{$Sort_by[$i]}} = $i; } for $key (sort { sort code } keys %sort) { for(@{$sort{$key}}) { print "Index: $_ - Data: $key\n"; } }
so you can keep the index even if the data is the same, you could also lowercase the data in the hash keys and grab the original data out of the original array with the index value. The secret is push the values onto the hash as an array, so you get all your dupes...

I'm not sure if that's what you want or not
                - Ant