in reply to reading file

saranperl:

You don't even need to use perl for that. If you're on a *NIX box, you could use the following command:

sort -u original_file >new_file

But since you're here, you might want to know how to do it in perl. So you could do it in roughly the same way the sort command does it:

  1. Read the file into in array
  2. Sort the array, so all duplicates will be next to each other
  3. Scan through the array and remove adjacent duplicates
  4. Write the array to the new output file

Give it a try and let us know if and where you get stuck!

...roboticus