http://qs1969.pair.com?node_id=1026813

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

Hi Oh Wise Ones, I am looking for some perls of wisdom. I am searching a log file for email addresses ending in @tiles.ie The code I am using is giving me duplicates so I get gerry@tiles.ie printed to the output file 10 times. What I am trying to do is output each email address only once. My Code is :-

open(LOGFILE, "logs") or die("Oh Magoo !!! You've done it again."); my @entries = <LOGFILE>; close LOGFILE; open (FH, ">> log_report.txt") or die("Oh Magoo !!! You've done it aga +in."); # Purpose Print all email addresses ended with @tiles.ie $i = 0; while ($i != @entries) { while ($entries[$i] =~ /([A-Za-z0-9._-]+\@tiles.ie)/g) { print FH $1 . "\n"; } $i++; }
Thanks in advance for you help. G