Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Answer: How do I compare two strings?

( #330761=categorized answer: print w/ replies, xml ) Need Help??

Q&A > strings > How do I compare two strings? 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


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

Comment on Answer: How do I compare two strings?
Re: Answer: How do I compare two strings?
by Mr. Muskrat (Abbot) on Feb 21, 2004 at 04:51 UTC
    The inequality operator is ne.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2015-07-04 23:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls