!#c:\perl\bin print "Content-type: text/html\n\n"; @linestring = ("line 1\n", "line 2\n"); open(MYFILE, ">c:\\outfile.dat") || die print "Error encountered opening file ... $!"; for($i = 0; $i < 5; $i++) { $thisline = $linestring[$i]; print MYFILE "$thisline"; } close(MYFILE); print "Data has been written ..."