I also could have done this in storable, but storable's freeze and thaw are broken on ultrasparc/solaris. So I used Data::Dumper. You get the idea, and could switch over to Storable to make it faster if you were so inclined.
Suggested usage:
my @newarray = grep { hcmp( \%goodhash, $_ ) } @somebadhashes;
sub hcmp { use Digest::MD5 qw{ md5_hex }; use Data::Dumper; my ($a, $b) = @_; my $astr = md5_hex( Dumper( $a ) ); my $bstr = md5_hex( Dumper( $b ) ); return ($astr eq $bstr) ? 1 : 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare two hashes inefficiently.
by MrNobo1024 (Hermit) on Sep 08, 2001 at 03:17 UTC | |
|
Re (tilly) 1: compare two hashes inefficiently.
by tilly (Archbishop) on Sep 08, 2001 at 19:05 UTC | |
|
Re: compare two hashes inefficiently.
by jmcnamara (Monsignor) on Sep 08, 2001 at 15:13 UTC | |
|
Re: compare two hashes inefficiently.
by OfficeLinebacker (Chaplain) on Jan 11, 2007 at 13:21 UTC | |
by deprecated (Priest) on Feb 10, 2007 at 10:50 UTC | |
by OfficeLinebacker (Chaplain) on Feb 10, 2007 at 15:31 UTC |