in reply to Stopping bad input (harder than sanitizing)

If $search->get() is returning undef on <RET> then change the condition in the goto line so it avoids an infinite loop.

It's probably also useful to autoflush stdout to see the feedback as it is generated, rather than once the buffer is sufficiently full. See https://perldoc.perl.org/perlvar#$%7C.

# somewhere in your code, perhaps in the search sub itself. local $| = 1;