in reply to Parsing Data file
If it is an S-expression, then you're in luck because CPAN has a module Data::SExpression.
Otherwise, I suggest you look at CPAN modules such as Parse::Yapp.
The general concept behind these “parser generators” is that you solve your problem by constructing a grammar, which is a formal definition of the language you are dealing with. This definition also says “what to do when” a particular language-construct has been recognized. Then you invoke your parser, give the input, and wait for calls to be generated to the routines that you've defined.
In this case, the odds are very good that someone else has already built a parser or recognizer for this file-type, whatever it is. Someone has probably solved this problem thoroughly, and submitted something useful somewhere in CPAN. So it becomes your chore merely to find it, not to (re-)build it. Look (in CPAN and in search-engines) for references to whatever product is known to have produced this file. See what the vendor calls files of this type.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing Data file
by zer (Deacon) on Feb 07, 2008 at 19:51 UTC |