http://qs1969.pair.com?node_id=193862


in reply to Uniqueue

I'm curious, why did you use delete instead of overwriting the hash ref? This:
delete @{$self->{'hash'}}{ keys %{$self->{'hash'}} };
must be less efficient than this:
$self->{hash}={};
Are you worried about someone else having a reference to the same hash?
--
Mike

Replies are listed 'Best First'.
Re: Re: Uniqueue
by Zaxo (Archbishop) on Aug 29, 2002 at 20:00 UTC

    Heh, even brand new code has cruft. That was a leftover which had been the last line, providing the list of values to return. I decided that was no good without keeping their order, but the delete line never got changed. Thanks!

    The line in question, #38 in the clear method, is replaced with RMGir's suggested one. That makes the hash values no longer significant, so assignments to them have been changed to a ++ bump. $VERSION incremented and RMGir credited.

    After Compline,
    Zaxo