#!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; use Data::Dumper; my $href = &share({}); $href = {}; sub sub1 { sleep 1; print threads->tid(); print Dumper $href; } $href->{a} = &share({}); $href->{a} = {}; my $th1 = threads->new('sub1'); $href->{b} = &share({}); my $th2 = threads->new('sub1'); $th1->join(); $th2->join();