in reply to Matching elements in two arrays and printing the element next to the match.
You don't do any error checking and you don't use warnings which would allow Perl to alert you of unopened files. When opening files, use the following:
... open (FILE1,$p) or die "Couldn't open file '$p': $!"; ...
Also, your approach will be very (very) slow, because for each entry in the first file you will go through all lines of the second file. It will likely be better to store the entries from the smaller file in a hash and then go through the larger file once and compare the entries to it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching elements in two arrays and printing the element next to the match.
by 7stud (Deacon) on Mar 22, 2010 at 11:52 UTC | |
by Anonymous Monk on Mar 23, 2010 at 05:15 UTC |