in reply to Perl Idioms Explained - keys %{{map{$_=>1}@list}}
Hi broquaint,
or, to keep the order that the items are inserted (ie. the order in which the first instance of a value is encountered)
my %seen; @uniq = grep ! $seen{$_}++, @list;
cheers
thinker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Perl Idioms Explained - keys %{{map{$_=>1}@list}}
by LanceDeeply (Chaplain) on Aug 04, 2003 at 18:58 UTC | |
by RMGir (Prior) on Aug 04, 2003 at 20:28 UTC | |
Re: Re: Perl Idioms Explained - keys %{{map{$_=>1}@list}}
by Jasper (Chaplain) on Aug 04, 2003 at 22:21 UTC | |
by cees (Curate) on Aug 05, 2003 at 03:32 UTC | |
by Aristotle (Chancellor) on Aug 05, 2003 at 17:51 UTC | |
Re^2: Perl Idioms Explained - keys %{{map{$_=>1}@list}}
by Aristotle (Chancellor) on Aug 04, 2003 at 20:12 UTC | |
by dragonchild (Archbishop) on Aug 04, 2003 at 20:14 UTC | |
by Aristotle (Chancellor) on Aug 04, 2003 at 20:19 UTC |