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

So, if you don't want your program to die, why do you use close or die? There are valid situations when close returns a false value, as you've found out, for example when the receiving end of the pipe has gone away.

Replies are listed 'Best First'.
Re^4: pipe to less crash
by Anonymous Monk on Jul 05, 2011 at 13:47 UTC

    The way my program works is that the user sees a list of files and they can choose one and it will open with less, but then once they exit less, I want them to be brought to the program.

      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;