http://www.perlmonks.org?node_id=1004551


in reply to Program unexpectedly terminates

Assuming you have an UNIX-like system, try running your program under strace. This will produce a lot of text, but probably last lines will show you the reason.
Sorry if my advice was wrong.