http://www.perlmonks.org?node_id=259902


in reply to Never lock $0 inside of a BEGIN block

You commonly cannot lock a file exclusively if you don't open it for output... Are you sure this isn't a problem?