1 Java[ | ]

Java
Copy
PrintWriter pw = new PrintWriter( new FileWriter( "test.txt", true ) );
pw.println( "World" );
pw.close();
Java
Copy
BufferedWriter bw = new BufferedWriter( new FileWriter( "test.txt", true ) );
bw.write( "World" );
bw.close();
2 PHP[ | ]

PHP
Copy
file_put_contents('greet.txt', 'world', FILE_APPEND | LOCK_EX);
PHP
Copy
file_put_contents('greet.txt', 'world', FILE_APPEND );
3 Python[ | ]
Python
Copy
with open('greet.txt', 'world') as f:
f.write(s)
4 Perl[ | ]
Perl
Copy
my $s = "World";
open my $fh, ">>", 'name.txt';
print $fh $s;
close $fh;