in reply to problem in dumping sql results in a file

open (FILE, ">results.txt" ) or die ...

The current directory is not what you think it is. And as you run that cron job as root, and root is allowed to write everywhere, you don't get an error, but a file results.txt somewhere on your filesystem. Maybe it is in /results.txt.

chdir to the proper location before writing your file or use absolute path names in the output name of the file.