I've only used this code on win2k, so I can't say that it will work on *nix boxes. You'll have to try that for yourself.#!/usr/bin/perl -w use strict; use vars qw($ret $reply); # Signal handler $SIG{INT} = 'intSub'; while (1) { $ret=get_input(); print "\nget_input returned: $ret\n"; } sub get_input { # Give prompt print "Enter value: "; $reply=<STDIN>; return 0 unless $reply; chomp($reply); print "You typed: $reply\n"; return 1; } sub intSub { # Reset signal handler $SIG{INT} = 'intSub'; };
In reply to Re: Keyboard Input Interrupt
by t0mas
in thread Keyboard Input Interrupt
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |