You wrote
I would think this would be better:
exit "Sorry, name can't be empty"
if $name eq ''
;
It's not, as per perldoc -f exit
exit EXPR
exit Evaluates EXPR and exits immediately with that value. Example:
...
Your code does exit 0 if $name eq '' which may or may not be what is intended, but what looks like a message being printed - isn't. Try at your shell
perl -e 'exit "foo"'; echo $?
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}