use strict; open FH, '<', 'test1.dat' or die $!; my %h; $h{FH}=FH; flock( $h{FH}, 2); close $h{FH}