in reply to readline() on unopened filehandle

In line 10, the one you note, $FH is the file name, not a handle. I'm not sure you want that line at all, since you just read a line to the same variable in the while condition. I suspect you're trying to detect eof there, but you'll also clobber your loop variable and skip every other line of the file.

I think you need to review your code carefully. I'm not sure what you're trying to do, but I'm certain that this won't do it. Your do {} until //; loop keeps tacking the same text onto $batch until it matches something that that it never will if it didn't the first time round. You'll loop endlessly and $batch will grow until you run out of memory.

Update: If you are trying to detect eof to skip the last line, this works,

while (<$fh>) { last if eof; print; }

After Compline,
Zaxo