Hi folks,  I'm trying to figure out a slick way to find out if a
particular hashref is in an array of hashrefs.  Also acceptable would
be to extract only the unique elements from an array of hashrefs.

I've tried the examples in perlfaq for both of those questions but the
answers leave me with strings that look like this, HASH(0x8148b44),
rather than actual hashrefs.

So is there a slick way to do this?  Or, alternatively, is there a way
to convert that string back into a real hashref?

Below is some test code of one attempt that just leaves me with the strings:

Thanks in advance for your ideas!

- Andrew Jorgensen


#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;

my @tree;
my $zero = { a => "0", b => "0" };
my $one = { a => "1", b => "1" };

push @tree, $zero, $one, $zero, $one;

my %saw;
@[EMAIL PROTECTED] = ();
my @out = keys %saw;

print Dumper(@out);

/*
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