#!/usr/bin/perl -w use threads; # threading routines use threads::shared; use Thread::Queue; our $queue : shared = Thread::Queue->new; for (1..30){ $thr = threads->new(\&thread_sub); } for (1..30) { $thr1 = threads->new(\$thread_sub1); } $thr->join; $thr1->join; sub thread_sub { while ($test == 0) { if (certain test is true) {$test = 1;} } #### Now here is where I am getting really god damned lost {my $action = $queue->enqueue;} } sub thread_sub1 { $action = $queue->dequeue; #??? totally lost here print "I am going to do your bidding master now that the test is true\n"; }