Well, sure, I fully appreciate your point, but, to start with, this is just a brief simple example, which would have to be adapted to the exact needs. My point was really to show the algorithm: store the content of one file in a hash and then read the second file and use the data stored before. Storing the data in the hash can be done in many many different ways (hash of arrays, hash of hashes, XML, CSV, fixed-length, etc.), I just chose a very simple way because this was not really the subject of the post (wghich was the algorithm to do the job).
Then, the OP said he just needed to print out metrics 1 to 4; merging the data before storing into the hash makes things as simple as they can be when it comes to print them out. Any decision to make things more complex would just complicate the explanation of what needs to be done and would be actually meaninglessly premature so long as you haven't seen any of the data.
And, BTW, I received an MP from the OP saying: "Thanks so much! It works just like I wanted!"
-
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.
|