in reply to Getting from Oracle to become a text file

You're simply not printing anything to your file!

Try adding:

print BATCH $newfile, "\n";
within the body of your while loop.

Just because you've reused the variable name ($newfile) doesn't connect the data with the file you've opened earlier. That's what BATCH is for.