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 reply to Re: Comparing Strings
by 7stud
in thread Comparing Strings
by maheshkumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |