Perl: Writing to a file
Writing to a file is very similar to reading it. And just, because reading and writing in perl is so easy and fast that Perl is ideal for scripting and data extraction purposes. Data can be written to another file using handles as follows: Suppose, you want to read a following file called "program.txt" that contains the following data (id and language) and write the languages part to another file "output.txt" using perl program:
The program that would read this and print languages is:
Note that adding ">" sign to the file name when opening it signifies that we want to write to the file. ">>" sign shows that we want to append to the file. When writing to the file, we print to the hande as in statement we wrote to the handle outFileHandle:
The output.txt file now contains:

Recent comments
6 days 22 hours ago
2 weeks 4 days ago
4 weeks 6 hours ago
4 weeks 2 days ago
4 weeks 4 days ago
4 weeks 5 days ago
29 weeks 1 day ago
29 weeks 5 days ago
29 weeks 5 days ago
30 weeks 14 hours ago