The statement $name = <STDIN>;
reads from standard input and includes the terminating newline character “\n
“. Remove this character using the chomp
function:
print "What is your name?\n";
$name = <STDIN>;
chomp($name);
if ($name eq "Jon") {
print "We have met before!\n";
} else {
print "We have not met before.\n";
}