Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How do I compare two strings?

by PipTigger (Hermit)
on Jul 07, 2000 at 09:26 UTC ( [id://21412]=note: print w/replies, xml ) Need Help??


in reply to How do I compare two strings?

As an addendum to turnstep's fine post: Another useful test is: ne ... as in:
if ($string1 ne $string2) { print "\$string1 is not equal to \$string2\n"; }

Just as: == tests equality between two numbers,
!= tests inequality for numbers and
eq tests strings for equality as
ne tests strings for inequality.
I often find it useful to test
if ($string0 ne "") { #use $string0 }
to verify that a string has a value even if it's == 0.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found