Hi all, I have quite interesting work. Example:
In txt I have some words (up to 100.000) - words.txt (without line numbers): 1. foo 2. bar 3. foo bar 4. foo bar bar 5. bar foo bar 6. bar bar foo 7. foo foo bar 8. foo bar foo bar 9. foob bar 10.foo bars and so on... Now, I have to find all 2 words sentences with their sums in the list. For example for this list it could be (without reporting lines): "foo bar" - 5 times (lines: 3, 4, 5, 7, 8) "bar bar" - 2 times (lines: 4, 6) "bar foo" - 3 times (lines: 5, 6, 8) "foo foo" - 1 time (line: 7) "foob bar" - 1 time (line: 9) "foo bars" - 1 time (line: 10) I did this by hand...but anyone know how to this effectively in perl? I think I have to build hash of all possibilities of 2 words sentences (in input txt are allowed only [0-9a-z ]), in list I will have lines of input txt, and iterate every key in hash over array, writing value to hash its occurence ("foo bar" => 5)...hm ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>