in reply to Re^4: pipe to less crash
in thread pipe to less crash

I'm sorry that I was unclear in my response.

In your code, you use the following statement:

close LESS or die "can't close: status = $?";

... but you do not seem to want your program to die. So, a solution is to not call die instead:

close LESS;