I wrote the following code and when I take an string input from the user the Strings do not match, whereas if I just define a string then they match. What is the problem with the following code as it is giving "It does not match"
Thanksprint "Enter a word: \n"; $string1 = <STDIN>; $string2 = 'Mahesh'; if($string1 eq $string2){ print "Match \n"; } else { print "Does not match \n"; }
In reply to Comparing Strings by maheshkumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |