#!/usr/bin/perluse strict;my $interruptions = 0;$SIG{INT} = \&handle_interruptions;while ($interruptions < 3) { print "waiting.\n"; sleep(5);}sub handle_interruptions { $interruptions++; warn "interrupted ${interruptions}x.\n";}