use threads; use Thread::Queue; my $Q = new Thread::Queue; async { while( $Q->dequeue ) { my @array = split $; $_; ... } }->detach; my @array = 1 .. 10; $Q->enqueue( join $;, @array ); ... #### use threads; use Thread::Queue; my $Q = new Thread::Queue; async { while( $Q->dequeue ) { my %hash = split $; $_; ... } }->detach; my %hash = 'a' .. 'z'; $Q->enqueue( join $;, %hash ); ...