open (1,"file.txt",5) ;using mode 5 means that is file is not found create it and open it for output
gets $input
writeline(1,$input + chr(13) + chr(10))

to stop the 0's that are put on the screen I use a $q = for the open and writeline commands

$q = open(1,"test.txt",5)
.....

Bryce