Hill, Greg wrote:
Can't you just do:

my %seen = ();
my @unique = grep { !$seen{$_}++ } @tree;

Actually this would be more efficient (and perlish):

my @unique = do { my %s ; @s{ @trees } = '' ; keys %s };

Or am I missing something?

Yeah. He was getting the stringified reference (HASH(0xABCDEF)) as a key and he wanted the actual data as a key. So you have to serialize the referenced data for each key and have some way of bringing it back as a reference of values.

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to