Hi,
I have two files containing data that i would like to compare.
Both files contain key value(common key) that i would like to match and print out. What would be most efficient method of doing a comparison?
eg,
file1 contains
some_data key some_data
file2 contains
different_data different_data key
I opened both files and add one file to array and the other to hash then did comparison based on the key using nested for loops. Would there be better method of comparing?
thank you in advance.
Sorry for the lack of clarity in my question.
I have a list of all the employee's names in one file and the other fi
+le has some names from some department.
Input All employee file:
John Smith
Terry Smith
Input Dept file:
HR John Smith 6th floor
R&D Terry Smith 5th floor
I would like output to be if John Smith in Dept file exists in All emp
+loyee file, print out his info.
Hope that helps clear the question a bit.
Thanks for your advice. Will definitely read the how not to ask questi
+on :)
-
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.
|