Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Comparing Strings

by 7stud (Deacon)
on Jun 24, 2012 at 05:05 UTC ( #978035=note: print w/ replies, xml ) Need Help??

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\n

So your $string1 variable will look like this:

$string1 = "Mahesh\n"

...and that will never be eq to the string "Mahesh"

Comment on Re: Comparing Strings
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978035]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-11-29 16:32 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls