Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
if the contents of file1 match a column of data in file 2 printout to a new file the entire line whith mtached data. I have tried putting both files into an array and then use foreach to search, but having problems (naturally)file1: 1 2 3 file2: 55 1 65 2 76 3
thanksopen (file, "<file1"); while (<file>) { @array=$_; } open (file2, "<file2"); open (out, ">out"); while (<file2>) { @array2=$_; ($one, $two) = split (/\s+/, $_); } foreach $file2 (@array2) { foreach $file1 (@array) { ###lost here
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching an array
by dragonchild (Archbishop) on Jul 19, 2004 at 19:41 UTC | |
by Anonymous Monk on Jul 19, 2004 at 19:51 UTC | |
by dragonchild (Archbishop) on Jul 19, 2004 at 19:55 UTC | |
by Anonymous Monk on Jul 19, 2004 at 20:22 UTC | |
by dragonchild (Archbishop) on Jul 19, 2004 at 21:58 UTC | |
|
Re: matching an array
by davorg (Chancellor) on Jul 19, 2004 at 20:07 UTC | |
|
Re: matching an array
by graff (Chancellor) on Jul 20, 2004 at 03:08 UTC | |
|
Re: matching an array
by pbeckingham (Parson) on Jul 19, 2004 at 19:44 UTC |