$| = 1; use Data::Dumper; use threads;; use threads::shared; my @r = ( map+{ map{ $_ => [ 1 .. 2 ] } 'a' .. 'b' }, 1..2 );; my @s : shared = map shared_clone( $_ ), @r; sub A { while ( 1 ) { print Dumper \@s; sleep 3; } } sub B { while ( 1 ) { my $cmd = ; chomp $cmd; push @s, { $cmd => time } } } $th1 = threads -> new ( 'A' ) ; $th2 = threads -> new ( 'B' ) ; $th1->join(); $th2->join();