Hashes have very fast processing speeds. Using them for finding unique values of an array like this will work nicely, and very fast even over larger files.
I recently had to do something similar for a project, and the hash solution worked nicely, and the speed was blazing in comparison to my original 'nested looping' solution.