in reply to Remembering original order of an array

If the order of the elements of your array is important, why don't you use an array in which each element is an anonymous array with its first element the value of the original element and the second element the original sequence number? That way you can always restore the original order by a simple sort on the second element of anonymous array:

my @array=(['C',0],['B',1],['A',2],['C',3]);

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James