Not a direct answer to your question, but a simpler, threaded solution that might work for you:

#! perl -slw use strict; use threads; use threads::shared; use Time::HiRes qw[ sleep time ]; use Text::LevenshteinXS qw(distance); my $minimum_score = 50; my $max_childs = 4; my %contacts :shared; get_db_data( \%contacts ); print "Starting with max: $max_childs concurrent threads"; my $start = time; for my $id ( keys %contacts ) { sleep 0.1 while threads->list >= $max_childs; async( sub { my $source_name = shift; my $counter = 0; for my $contact ( keys %contacts ) { my $dest_name = $contacts{ $contact }; next if $dest_name eq $source_name; my $distance = distance( $source_name, $dest_name ); my $score = 100 - ( $distance * 100 / length( $dest_name ) + || 1 ); if( $score >= $minimum_score ) { print "$id looks like $contact"; } ++$counter; } printf "Thread %d compared $id with $counter contacts\n", thre +ads->tid; threads->self->detach; }, $contacts{ $id } ); } sleep 0.1 while threads->list; printf "Took %6f seconds\n", time() - $start; exit; sub get_db_data { ## mock_up my $ref = shift; $ref->{ $_ } = join '', map{ ( 'A', 'C', 'G', 'T' )[ rand 4 ] } 1 +.. 1e2 for 1 .. 25; return; } __END__ c:\test>866682 Starting with max: 4 concurrent threads Thread 1 compared 11 with 24 contacts Thread 2 compared 21 with 24 contacts Thread 3 compared 7 with 24 contacts Thread 4 compared 17 with 24 contacts Thread 5 compared 2 with 24 contacts 22 looks like 1 22 looks like 24 Thread 6 compared 22 with 24 contacts 1 looks like 22 Thread 7 compared 1 with 24 contacts Thread 8 compared 18 with 24 contacts Thread 9 compared 23 with 24 contacts Thread 10 compared 16 with 24 contacts Thread 11 compared 13 with 24 contacts Thread 12 compared 25 with 24 contacts 6 looks like 5 Thread 13 compared 6 with 24 contacts 3 looks like 14 Thread 14 compared 3 with 24 contacts Thread 15 compared 9 with 24 contacts Thread 16 compared 12 with 24 contacts Thread 17 compared 20 with 24 contacts 14 looks like 3 Thread 18 compared 14 with 24 contacts Thread 19 compared 15 with 24 contacts Thread 20 compared 8 with 24 contacts Thread 21 compared 4 with 24 contacts 24 looks like 22 Thread 22 compared 24 with 24 contacts Thread 23 compared 19 with 24 contacts Thread 24 compared 10 with 24 contacts 5 looks like 6 Thread 25 compared 5 with 24 contacts Took 0.395703 seconds

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re: Using complex data with IPC::Shareable by BrowserUk
in thread Using complex data with IPC::Shareable by glasswalk3r

Title:
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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.