|Don't ask to ask, just ask|
It may be that open fails when you try to access an array element that doesn't exist.
You initialize @lines with the contents of your file, then you iterate over the array, but you don't stop when you reach the end of the array: you keep going for two more iterations.
In scalar context (like when adding 1 and assigning to $count), @lines evaluates to the number of elements in the array. In your example: 11. Then you add 1, so $count is set to 12. You iterate while $k varies from 0 through 11 and stop when it reaches 12. But the indexes for your array are 0 through 10 - there is no element with index 11.
You could set count with $count = @lines - 1 or, even better $count = $#lines, but you don't use $k except to get elements from $lines, so you would be better to use a loop like:
Another possibile cause of your fault is that you have line termination characters in your file names but you probably don't have files with names that end with line termination characters. You can use chomp to remove these characters.
In reply to Re: No such file or directory at R_loop2.pl line 19.