in reply to Need Help with writing to flat file from add_record sub

Where $field is one of ('foo', 'bar', 'baz'), ${$field} is not anything you want. That expression is appropriate to dereference \'foo', say. Your $field is not a reference (though it could be a symbolic reference, a dreary game). Were you trying to populate a hash there? If so, insert an identifier between the initial dollar and the braces.

Your conditional for opening on existence of $database is unnecessary and dangerous. Just use ">>" open always. The danger comes when another instance races to create the database. Calling sysopen instead would let you handle locking and exotic modes all at once. (Added) As fglock says, don't seek if opened to append.

After Compline,
Zaxo

  • Comment on Re: Need Help with writing to flat file from add_record sub