> > I like this very much and I'm assuming it's faster than
> > putting them in hash and returning the keys as an array
> > since you don't have to build a hash.
> 
> Actually you *do* build a hash. :-)
Oh yeah, duh what am I smoking?


> 
> > @unique = do {
> >     my %seen; 
> >     grep !$seen{$_}++, @arr
> > };
> 
> The advantages are that (a) it doesn't change the order 
> of the input array and (b) it's a common idiom that the
> next programmer in line will recognize instantly.
> 
> The hash-keys version would probably be a bit faster:
> 
>   @unique = keys %{ 
>       my %set;
>       @set{ @arr } = ();   # fast!
>       \%set;
>   };

I mihgt play around with that a bit too. Thanks!
Dan
> 
> But karma is more important than (a smidgen of) speed.
> 
> -- 
> Steve
> 

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

Reply via email to