in reply to Re^2: flock on on $^I
in thread flock on on $^I

fixed by adding this
my $lockopt = shift; if ( $lockopt eq "unlock") { do stuff... }
Being new to perl there's undoubtedly a better way of doing this !