in reply to Re^5: Repeat question (redo)
in thread Repeat question

Hi again. I've been going through your code and it's starting to make sense. However, what is the function DEFINED going.?

Until (defined $input && $input == $answer) { print "Sorry that's not right, please try again\n" if defined +$input;

Replies are listed 'Best First'.
Re^7: Repeat question (redo)
by hippo (Archbishop) on Dec 11, 2018 at 12:05 UTC

    It returns true if its argument is defined and false otherwise. See perldoc -f defined.

    The first time through the loop, $input is undefined so we don't want to try to compare it with anything and we equally don't want to warn the user that their guess was wrong when they haven't even entered a guess yet.