# Handle Ctrl-C $SIG{INT} = \&ctrlc; use autodie; use Modern::Perl; use Storable qw {store retrieve}; my $dbfile = 'sbs.db'; my %person = %{ retrieve($dbfile) }; while() { print "\n(C)reate,(L)ist,(N)ew,(M)odify,(R)emove,(Q)uit? "; chomp(my $choice = <>); $choice = lc $choice; # # Some code here # } exit; sub ctrlc { store \%person,$dbfile; print "You used Ctrl-C!"; exit 1; }