Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Removal of duplicated element in array.

by tty1x (Novice)
on May 06, 2013 at 14:10 UTC ( #1032302=note: print w/ replies, xml ) Need Help??


in reply to Re: Removal of duplicated element in array.
in thread Removal of duplicated element in array.

$1 is essentially a list of email addresses.

dddd@fgg.com
cccc@fgg.com
eeee@fgg.com
dddd@fgg.com


Comment on Re^2: Removal of duplicated element in array.
Re^3: Removal of duplicated element in array.
by 2teez (Priest) on May 06, 2013 at 14:15 UTC

    my %seen = map {$_=>1} <DATA>; use Data::Dumper; print Dumper \%seen; __DATA__ dddd@fgg.com cccc@fgg.com eeee@fgg.com dddd@fgg.com
    *UPDATE:
    If you care about the order of display then you can use this:
      print join "\n", sort{$a cmp $b} keys %seen;

    *Note: That was based on the assumption, that the original ORDER of data was inconsequential.
    Limbic~Region Thanks for pointing that out.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
      2teez,
      If you care about the order of display then you can use this

      The code in the OP looked like it was preserving the original order - what you have posted loses that ordering and sorting ASCIIbetically after the fact isn't going to re-instate it unless it coincidentally was sorted that way in the first place.

      Cheers - L~R

        Limbic~Region
        You are right. My post was on the assumption that, the OP wanted the output in 'ASCIIbetically', hence, the reason for my assertion. Thanks.

        If you tell me, I'll forget.
        If you show me, I'll remember.
        if you involve me, I'll understand.
        --- Author unknown to me

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032302]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-04-17 23:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (458 votes), past polls