You can find the answer to this exercise in "Answer for Chapter 19" in the Appendix.
19.8.1. Exercise [Infinite min]
Write a module to solve the halting problem with respect to Perl source code.[*] Your module should export a function, will_halt, which takes a string and returns true if the string is the source code for a no-input Perl program that does not infinitely loop, and false otherwise.