use strict; use warnings; use threads; use threads::shared; # make the shared value my %hash : shared; # create the key I want $hash{testElem} = 0; # attempt to lock it lock $hash{testElem}; # which fails.