in reply to Re^2: Writing to file
in thread Writing to file

Debugging is not a magical process that only monks can achieve... You just need to learn the common tricks, and apply some imagination.

For example, you're writing to a file, and its not working. Print out all the return values and input values as you go. And trim it down to a script that only writes a canned string to that file in order to eliminate possibilities.

Keep chopping off code until the problem either goes away or becomes trivial.