>>123
open my $fh, ">> $file";
return $fh;

でいいんじゃね?
つか、ひょっとして

OUT = lock_open( 'filename');

とかやってない? だとしたら間違い。