in reply to file dies instantly

Firstly, die with a message is preferable to exit.

I don't really see where the { "\n\n$ggg ... block fits in with either open or whatever (undisclosed) code surrounds it. The open documentation shows examples of using die.

As an alternative, take a look at the autodie pragma.

-- Ken

Replies are listed 'Best First'.
Re^2: file dies instantly
by Eily (Monsignor) on Jul 24, 2013 at 14:25 UTC

    Furthermore, if you use die you can add a sub reference into $SIG{__DIE__} (see die's documentation) that will be called just before the error processing is done. Which means you can add that "wait for user input" behaviour for several die calls at once. You can limit that modification to a dynamic scope with local.

    Be sure not to call exit in the sub that will be called when dieing, or else you might just as well have never died.