open my $fh, ">FILENAME" or die "Can't write FILENAME: $!";
print $fh "We are writing a line of text to a file.\nSecond line";
close $fh;
####
<%
Dim objFSO, objTextStream, file
file = Server.MapPath("samplefile.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile(file , 2, True)
objTextStream.WriteLine "We are writing a line of text to our text file" &
VBCfLf & "This is our second line of text" & VBCrLf
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
%>
##
##
try {
BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
out.write("We are writing a line of text to our text file\nThis is our second line of text");
out.close();
} catch (IOException e) {
}