Wednesday, October 21, 2009

Read file by blocks

Perl is very good at reading files lines by lines, using the new line as a separator. You can still define the separator character, by setting the '$/' variable (you can find an example here).
However, when you are reading a log file, with some logs on several lines, the only solution is to parse the text. But here, split comes to the rescue, and you can easily parse.

Read More...