#!/bin/perl -w use strict; use IO::Prompt; $SIG{'INT'} = 'INT_handler'; my $PROMPT="Yes or no? [YES,no] :"; while (prompt $PROMPT, -until => qr/YES|n|N/) { print "\nExcuse me? Say again?\n\n"; } my $YES_NO=$_; sub INT_handler { print_info("Caught signal Interupt. Cleaning up..."); exit(0); }