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 :-
Thanks in advance for you help. Gopen(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++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parse email address
by marto (Cardinal) on Apr 03, 2013 at 10:02 UTC | |
by BigGer (Novice) on Apr 03, 2013 at 12:37 UTC | |
|
Re: parse email address
by hdb (Monsignor) on Apr 03, 2013 at 11:09 UTC | |
by BigGer (Novice) on Apr 03, 2013 at 12:39 UTC | |
|
Re: parse email address
by Gangabass (Vicar) on Apr 04, 2013 at 01:05 UTC |