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.