On Wed, Jul 23, 2003 at 02:52:23PM -0700, John W. Krahn wrote:
> Steve Grazzini wrote:
> > 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;
> > };
> >
> > But karma is more important than (a smidgen of) speed.
>
> It may (or may not) be faster but it doesn't preserve the original
> order of the list.
Right; you might call that point "a" in the FAQ's favor.
I also think that putting three lines of code in a deref block
is appallingly ugly. These are both good reasons to prefer the
grep() solution.
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]