#! perl -slw use strict; use threads; use threads::shared; my %bighash :shared = map{ $_ => 1; } 'aaa' .. 'zzz'; sub thread { while( 1 ) { lock %bighash; 1 while each %bighash; } } my @threads = map{ threads->create( \&thread ); } 1 .. 8; $_->join for @threads;