#!/usr/bin/perl use Term::ReadLine; use sigtrap 'handler' => \&myhand, 'INT'; sub myhand { print "\n caught $SIG{INT}",@_,"\n"; } my $term = Term::ReadLine->new('test'); print $term->ReadLine()."\n"; $term->readline("try CTRL-C in some text here :"); #### marcel@machine:/tmp$ perl test.pl Term::ReadLine::Gnu try CTRL-C in some text here :auie ^C caught CODE(0x558c9e99acb0)INT marcel@machine:/tmp$