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.
In reply to Re: Remove Duplicates from Array
by friedo
in thread Remove Duplicates from Array
by jpk236
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |