#! perl -slw use strict; use threads; use threads::shared; my %h :shared = ( x => 1 ); lock $h{ x }; my @a :shared = 1 .. 4; lock $a[ 1 ];