https://jacoby.github.io/2021/05/24/escape-from-the-infinite-loop-perl-weekly-challenge-114.html