in reply to How to implement a timer in perl?
"... an alarm routine will trigger and exit the script."
Note: alarm may not work on all versions of Perl in Windows, and it may not be able to interrupt everything.
In ActiveState Perl 5.6.1, I get "The Unsupported function alarm function is unimplemented".
In ActiveState Perl 5.8.0, alarm was unable to interrupt $str = <STDIN>.