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:
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.