The author's problem was to remove duplicate elements from an input file,
not an array. While reading the elements from the input file
into an array and then applying the FAQ-given solution is one way of
solving the author's problem, there are other solutions available that
are simpler and more efficient (see my follow-up post for one of
them).
I agree that the FAQ is the first place
to look for answers and that we ought to point to it in responses to
questions like this. But I also think that we ought to read questions
carefully and answer the whole of the questions actually asked, even if the FAQ
answers similar questions for us. While it might be easy for some to
convert the FAQ's answers into the original questions' answers, that
task might be beyond some readers.
Updated: I removed the last half of this post because it was overly preachy. All I really wanted to say was, When we post pointers to the FAQ, let's also spend a few moments relating it back to the context of the original problem. I'm leaving this big Updated notice here as a humbling reminder to myself to stay off the soapbox.
Cheers, Tom
| [reply] |