CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Wazezu] Removal of duplicated element in array with order.: Edit Log



FishMonger
Veteran / Moderator

May 7, 2013, 6:27 AM


Views: 1225
Re: [Wazezu] Removal of duplicated element in array with order.

Try this:

Code
#!/usr/bin/perl 

use strict;
use warnings;
use Email::Address;
use Data::Dumper;

my $html = do { local $/; <DATA> };
my @addresses = Email::Address->parse($html);

foreach my $address ( @addresses ) {
print $address->format, $/;
}


__DATA__
dmit@sp.com
ems@es.com
dew@es.com
dmit@sp.com
erg@es.com


Output:
c:\testing>get_addresses.pl
dmit@sp.com
ems@es.com
dew@es.com
dmit@sp.com
erg@es.com

Removing the dups is left upto the reader. (hint, use a hash)


(This post was edited by FishMonger on May 7, 2013, 6:30 AM)


Edit Log:
Post edited by FishMonger (Veteran) on May 7, 2013, 6:30 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives