in reply to Run subroutine occasionally

You have not told us any details, so it's hard to guess what user interface you are using and what you are trying to do.

If you want to make sure your "subroutine" doesn't block the UI, running it in a different program altogether with interprocess messaging might be an option. This would also allow for the cyclic function to continue running without the UI open.

All this depends on your requirements and all the details you haven't provided, though. As for me, i usually use Net::Clacks for that stuff (of course, as the author of that module, i'm a bit biased). There are examples of a simple chat system, complete with chatbot and clock bot, if you are interested. Explanation is provided in this (slightly outdated) post: Interprocess messaging with Net::Clacks

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'