sub CLOSE { ## called on INT to clean up a bit close(SERVER); close $client; die 'Exiting on INT'; } $SIG{INT} = \&CLOSE;