Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Answer: How do I compare two strings?

by gridlock (Novice)
on Feb 21, 2004 at 04:36 UTC ( #330761=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > How do I compare two strings? - Answer contributed by gridlock

Depends on what kind of comparision: Strings can be tested for the following
Equality - the eq operator
Inequality - the ne operator
Greater Than - the gt operator
Greater or Equal - the ge operator
Less than - the lt operator
Less of Equal - the le operator

$stringtest = ($string1 eq $string2);
Try replacing eq with the other operators.

Replies are listed 'Best First'.
Re: Answer: How do I compare two strings?
by Mr. Muskrat (Canon) on Feb 21, 2004 at 04:51 UTC
    The inequality operator is ne.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2016-10-25 19:39 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (327 votes). Check out past polls.