britney has asked for the wisdom of the Perl Monks concerning the following question:

I have a flatfile record.txt
33, winxp, kansas,,,,, 55, win7, utah,,,,, 66, winxp, utah,,,,, 88, winxp, oregon,,,,,
How do i write in perl so if a word repeat twice or more in field #3 then it will email me those records?
Please check Utah, it repeat more than one. 55, win7, utah 66, winxp, utah
Thanks for teaching me.

Replies are listed 'Best First'.
Re: Read a file and email duplicate word in one field ?
by roboticus (Chancellor) on May 21, 2012 at 23:10 UTC

    britney:

    Detecting duplicate values in a file is a commonly asked question. Read perldoc perlfaq4 to get information on that (It's pretty easy: you just use a hash as a notepad to record all the values you've seen. So when you read each record from the file, you check the notepad to see if the value is already there.) As for creating and sending the EMail, I used to use MIME::Lite.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks, I just use awk and mailx to solve my problem. Thanks again
Re: Read a file and email duplicate word in one field ?
by Anonymous Monk on May 22, 2012 at 03:32 UTC

    Thanks for teaching me.

    Hmm, searching perlmonks, checking the faq, there is even a tutorial about it