in reply to Rename Duplicate List Elements in an Array

As ambrus noted, your solution, of appending some extra text, is at the mercy of characters at the end making the data. One solution, then, would be to scan the data to select the suffix that already does not exist in data.

Thinking out loud ... or, perhaps use (a heap data structure along w/ a count of each element which would then translate to) a priority list. That does not exactly make each element to be unique as presented in OP, but allows to define uniqueness in other way. That seems, however, quite heavy when we already can use %seen (populated inside the loop) instead of throwing it away. Hmm ...

Addendum, Oct 6,2005: I was thinking of priority value as a count of each string. If there are only few multiplcates, a priority list will be pointless. Using a heap will give you elements in sorted way (meaning lots of comparisons) even if sorting is not a requirement. So i would just use %seen under a different name and w/o the @newlist. Further, count can be stored along w/ list index of each element in a n array reference to encfore input order.