in reply to keyboard input during runtime...

Don't be sure if this can help you:
SIG{INT}=sub{exit}; END { open LOGFILE, ">filename"; print LOGFILE '...everything figured out up to now '; close LOGFILE; }
Now you can terminate your script with CTRL-C and before it terminates, it will do the END block. So you can do all the nesessary stuff in there to save your results.

update as tachyon mentioned, added the SIG{INT} line.

----------------------------------- --the good, the bad and the physi-- -----------------------------------

Replies are listed 'Best First'.
Re: Re: keyboard input during runtime...
by tachyon (Chancellor) on Aug 06, 2001 at 18:28 UTC

    Ah sorry this is wrong. CTRL-C this.

    sleep 1 while 1; END { print "Goodbye\n"}

    As you can see the CTRL-C zap is so fatal that the END block is not executed. You need to trap it with a $SIG{INT} as shown below. An END block will trap die though.

    die "I'm dead!\n"; END { print "Goodbye\n"}

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print