#!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; use Data::Dumper; use Config; printf "perl: %s\n", $Config{version}; printf "gcc: %s\n", $Config{gccversion}; printf "threads: %s\n", $threads::VERSION; printf "threads::shared: %s\n", $threads::shared::VERSION; my %hash :shared; sub sub1 { sleep 1; print STDERR threads->tid(); print STDERR Dumper \%hash; } $hash{a} = &share({}); my $th1 = threads->new('sub1'); $hash{b} = &share({}); my $th2 = threads->new('sub1'); $th1->join(); $th2->join();