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
24 weeks 10 hours ago
24 weeks 4 days ago
24 weeks 4 days ago
24 weeks 6 days ago
25 weeks 4 days ago
27 weeks 5 days ago
30 weeks 5 days ago
33 weeks 4 days ago
34 weeks 2 days ago
35 weeks 23 hours ago