my @uniqueIPs; #Just declare it as an empty array; # The resulting value in %count is equivalent to the execution of this statement: $counts{$_}++ for @ipAddresses; # This is the important piece. # The hash %counts uses each ipAddress as a key. # The first time an IP address is encountered, the key-value pair is created, with a value of zero. # the(++) increments that to 1. # The next time that IP is encountered, the value is incremented. So, at the end, the value for each key # contains the count of occurrances for that IP address (key). ... grep !$counts{$_}++, @ipAddresses # The "grep:searches through each value ($counts{$_} is the VALUE), and the negation (!) # looks for non-zero values. Because the operator used is post-increment($blah++), before negation, # the value returnedwill be zero for First-seen IP addresses only. For second and subsequent # sightings of the IP, the pre-negation value will be non-zero, and post-negation will be zero. # "grep" filters out, leaving only non-zero values, effectively returning all the KEYS of %counts, which is # all the unique IP's.