in reply to how do I write directly to a file

open (FH, ">> myfile.txt"); print FH; # whatever you want, whenever you want, using this command