use threads; use threads::shared; sub do_stuff{ print "$x \n"; #doesn't close over $x } my $x = 20; threads->create(\&do_stuff)->join(); #perl copies $x to the thread --output:-- #but the thread can't see $x