in reply to Text Menu Not Looping on CR/LF

I'd use
if $answer and $answer >=4
which can still give you some warnings if the user enters QWERTY or something similar. But why do not you use
if not exists $menu_selection{$answer}