Since no-one else has mentioned it, you might also want to look at Parse::RecDescent - write a parser that responds to the lines in which you are interested. It might not be suitable for your application - it can be somewhat slow - but if you like writing BNF it might be a good solution.