in reply to can't read the 2nd input file
You need to check your open calls for errors, as shown in "open" Best Practices - once you've got a more specific error message, we can help better. (And if you're not already, Use strict and warnings!)
Update: While what I wrote above is correct, looking at your code again, there are further issues: after while (<F1> ... reads the input file, it doesn't automatically reset to the beginning of the file. Also, since you're not using the while (<F1>) form and instead have added additional conditionals in the while condition, Perl is not going to assign the current line to $_ for you like it is with while (<F0>). And another thing I see is that you never reset $line_stop.
So overall, because even I am having a bit of trouble understanding what your code is supposed to be doing, I think you'll need to take a step back and rethink your logic. Note that instead of nested loops, a common approach is to first read one of the files into a hash (or other data structure), and then use that for lookups while looping over the other file. I would suggest you take a look at perlintro and the Basic debugging checklist.
Update 2: Here's a suggestion: You can read the list of IP addresses into an array by simply saying chomp( my @ips = <$ip_filehandle> ); (see also chomp). Then, in a basic while loop, read the lines of the file with the port specifications, and you can then select the IP address from the array - remember that arrays are indexed starting from 0, while your lines appear to be numbered starting from 1.
|
|---|