in reply to print # while doing file copy
You could use alarm and the proper signal handler.
$SIG{ALRM} = sub { print "got signal, bye bye!\n"; exit 0; }; alarm 2; sleep 10; __END__ got signal, bye bye! [download]
-- David Serrano