The below one works for me
use strict; use warnings; $SIG{INT}=\&handler; sub handler { while(1) { print "Do you want to really quit....."; chomp(my $a=<STDIN>); if($a =~ /y/) { exit(0); } elsif($a =~ /n/) { return; } else { next; } } } while(1) { }
Is this you need???
Your Attempt May Fail, But Never Fail To Make An Attempt
In reply to Re: Have $SIG{INT} ask if user wants to quit
by lakshmananindia
in thread Have $SIG{INT} ask if user wants to quit
by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |