#!/bin/perl $SIG{INT} = \&my_sub; sub my_sub { $SIG{INT} = \&my_sub; #do stuff } while (1) { #waiting for my signal... }