I\'m new to Perl and I\'m writing a program where I want to force the user to enter a word. If the user enters an empty string then the program should exit.
print "Enter a word to look up: ";
my $userword = ; # I moved chomp to a new line to make it more readable
chomp $userword; # Get rid of newline character at the end
exit 0 if ($userword eq ""); # If empty string, exit.