http://www.perlmonks.org?node_id=641046


in reply to Re^2: Remove redundency from an array
in thread Remove redundency from an array

You are right, it should have been just

@array = (shift @sorted)

(the parentheses are to make it an array assignment).

If there are many duplicates it might be more efficient to first remove the duplicates before sorting. But there is no transforming the array into a hash and back.

I can't tell which is more efficient. My intention was to show a different approach. It shows again that there are many ways to do similar things.