title: quick perl sigint handler
body: <p>What is the most convenient and clear way to handle program cleanup when receiving a Ctrl+C?</p>
  
  <p>For example when my socket server gets killed this way, the TCP socket never gets closed. I would like a nice one liner I can put at the top of the program to set a sigint handler (or something like atexit) to close certain sockets (or doing any other kind of cleanup) before terminating the program. </p>