You could cast them both to arrays and use the perl module
Algorithm::Diff to calculate the differences between them.

This will check if the entry is in array1 and not in array2 and
vice-versa - wonderful

Andy

 On Tue, 2003-08-19 at 12:31, Martin Bower wrote:
> apologies for perl content :-)
> 
> I have 2 hashes,  one with 10,000 entries and the other with 5,000,  and 
> these are loaded  from a database table(sybase).
> 
> %hash1  contains values such as "111.666.fff.jjj.ccc.222"
> %hash2 contains values such as "111.666.fff.___.ccc.222"   (where the ___ 
> can eixst in any position)
> 
> is there a quick way for me to see if a value contained in %hash2 exists in 
> %hash1  ? without resorting to as nested loop foreach hash, as below ?
> 
> foreach my $key ( keys %hash1 ) {
>     foreach my $check ( keys %hash2 ) {
>         $check =~ s/_/\./g;
>         if ($key =~ $check) {
>             print "$key matches $check\n";
>         }
>     }
> }
> 
> _________________________________________________________________
> On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile
> 


Reply via email to