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


in reply to Remove Duplicates from Array

Using the @ in front of a hash means you're doing a hash slice, which allows you to assign multiple values to multiple keys in one step. In this case, you're creating keys out of the values in @array, and assigning them all undef (since you've got an empty list on the right-hand side of the assignment.)

Then you extract all the keys from the hash using the keys function. Since making a duplicate hash key does not add a new key to a hash, this has the effect of removing all duplicates.