Dan Muey wrote:
> > @list1 = qw(two one two zero six five six seven zero);
> > @list2 = keys(%{{map{$_=>1}(@list1)}});
> > > hi,
> 
> Howdy
> 
> > > 
> > > I need a procedure to eleminate dupes in a @list
> > > 
> > > Ex: @list1 = qw(two one two zero six five six seven zero);
> > > 
> > > should be changed to:
> > > 
> > > @list2 = qw(two one zero six five seven);
> > > 
> 
> Here's a couple waysthat were recommended to me that
> don't have the overhead (if any) of map:
> 
> @list2 = do { my %t;grep !$t{$_}++, @list1 };
> @list2 = keys %{ my %s;@[EMAIL PROTECTED] = ();\%s; };
                            ^^^^^^^^
This should be @list1 to keep the examples in parallel

> 
> Does anyone know for sure if they both ot one or the other
> keeps the order of the elements in the array?
> (IE - First instance first, like in the OP example)

The first one maintains order. The second does not.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to