Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
ok, so, if performance, speed, and anything good is not a problem to trample on, how about this:
#!/usr/bin/perl -w use strict; use Data::Dumper; use Digest::MD5 qw(md5_hex); # I want to group domains together if they share at least two of those + values. # The 1st two entires match, the 3rd not my %domains = ( '' => { phone => '1234', company => 'big co', contact => 'john', address => 'cool street', fax => '5678', email => '', }, '' => { phone => '2222', company => 'small co', contact => 'jeff', address => 'bad street', fax => '5678', email => '', }, '' => { phone => '9999', company => 'another co', contact => 'judy', address => 'nasty street', fax => '8888', email => '', }, ); # Build permutation hash foreach my $domain (keys %domains) { # Iterate over all the elements in the domain hash foreach my $o_attr (keys %{$domains{$domain}}){ # As we're creating hashes of each permutation we need to iter +ate # over the same elements foreach my $i_attr (keys %{$domains{$domain}}){ $domains{$domain}{hash}{$o_attr}{$i_attr} = md5_hex(${$dom +ains{$domain}}{$o_attr}.${$domains{$domain}}{$i_attr}); } } } print Dumper(%domains);

You can then loop over all the permutations looking for hashes that match!

In reply to Re: Building "islands" of related data by Ryszard
in thread Building "islands" of related data by japhy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (13)
    As of 2014-07-29 16:21 GMT
    Find Nodes?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:

      Results (222 votes), past polls