in reply to opinion - enormous input files

You've gotten good answers already regarding how to do the actual count of unique strings, but none have directly addressed the question of "Would you evaluate each line as you are reading the file, or would you read the whole file into an array or hash and then evaluate, or would you do it another way?"

As a general rule, any time you want to go over a file and just do one thing to each line, your best option will typically be to evaluate each line as it is read. Reading it all into an array and then walking through the array to evaluate each line would just waste time (since you're making two passes over the data, even if you're only reading the file once) and memory (since you need to store the entire file in memory).