in reply to Comparing Strings
When the user types something in response your prompt:
Enter a word:(which by the way would be better without the "\n"), they type in a word, and then they hit Return; and when they hit Return an invisible newline character is entered into the input stream:
Enter a word: Mahesh\nSo your $string1 variable will look like this:
$string1 = "Mahesh\n"...and that will never be eq to the string "Mahesh"
|
---|
In Section
Seekers of Perl Wisdom