Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
laziness, impatience, and hubris
 
PerlMonks  

Re: Remove duplicate data from text file

by dragonchild (Archbishop)
on Nov 27, 2001 at 19:35 UTC ( [id://127903]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Remove duplicate data from text file

  1. Read the file into an array
  2. Create a hash whose keys are the values in the array
  3. Create an array from the keys of the hash
  4. Print the array out to a file
The details are left as an exercise for the reader.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

  • Comment on Re: Remove duplicate data from text file

Replies are listed 'Best First'.
Code
by ggoebel (Sexton) on Nov 27, 2001 at 20:31 UTC
    my $filename = ...; local $/; open IN, $filename; $text = <IN>; @words{split /\s+/, $text} = undef; @words = keys %words;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://127903]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.