If possible, I'd break this into two tasks: Parsing the input file, and then processing the data. (I am assuming the intent is to do the same thing with all the files, just that the data format is slightly different.)
The end result I'd be aiming for is a script and several modules (one per data format, most likely). Then you run the script, have some way for it to figure out which parser to pass it to (either automatic or manual as a command-line switch), and have it then take back the data in some cannocial form (hash?) and do whatever you want.
(Note/Advertisement): If the data files are all line-oriented (that is: Each line can be read on it's own), my Mail::Log::Parse modules (which I'm working on generalizing, not that it needs much work) can do a lot of the heavy lifting of opening, buffering, seeking, and decompressing the files for you, leaving you to only writing one function for parsing per file format.)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|