There are two things here: there seems to be no Perl tool that will provide a simple solution to your problem and, I suspect, that this task is rather beyond your current programming abilities. While we can provide various suggestions and even substantial code, at the end of the day you have to be able to assimilate that information and use it to complete your task.
There are many ways to solve your problem. The regular expression based approaches offered so far are appropriate for the the fairly straight forward parsing/extraction problem you have presented and in fact if that is the exetent of your task then it has already been solved for you. I suspect though that the problem as expressed is actually a small part of a larger project that may be better tackled with heavier duty tools, which is why I mentioned Parse::RecDescent. However more powerful tools generally require more work to understand and use.
If you provide us with the larger picture we may be able to suggest an alternative way of tacking the bigger issue rather generating more frustration for everyone by trying to solve parts of it piecemeal and out of context.
DWIM is Perl's answer to Gödel
|