in reply to Double While!

This is what you are doing:

If we take 2 files like so:
/tmp/file1
1
2
3
4

/tmp/file2
a
b
c
d
e

We'd get these results using your code:
outer loop $_= 1
inner loop $_= a
inner loop $_= b
inner loop $_= c
inner loop $_= d
inner loop $_= e
outer loop $_= 2
outer loop $_= 3
outer loop $_= 4
What we see is that the inner loop isn't working... care to know why? You need to open and close the inner file. Otherwise file2 is not set to the start again after each search, it will be EOF for subsequent loops. The $_ are fine,

I would recommend using foreach rather than while, and if the files are small enough why not load the files into arrays and drive the comparison off them? If the files are of a size and the computer you're using is of a low power, think about using a sorted file and a binary chop and index the search file, just a thought... The O'Reilly Wolf book or the Perl Cookbook are great places to look for examples.

Hope this helps...

--
Brother Frankus