in reply to Removing duplicates from an array

To try to answer your update. The subroutine builds a hash using the elements of the input array as keys (the values are just set to 1, and not used). Since hash keys are unique, any duplicates will just overwrite the previous value. It then dumps the keys (using keys), and implicitly returns the resulting array. Use it thus:
my @no_duplicates = r(@original_array);

Replies are listed 'Best First'.
Re^2: Removing duplicates from an array
by alexm (Chaplain) on Jan 03, 2008 at 16:49 UTC
    my @no_duplicates = r(@original_array);
    Please, note that this method may not preserve the original order of the array values. But uniq function from List::MoreUtils does, as mentioned in perlfaq4 and PBP.