Or even if you don't want them to be identical but just similar in that they
contain the same string somewhere within the variable, i.e.
$a2 = 'Lambott';
$a3 = 'fooLambottblah';
if ($a3 =~ /$a2/) {
# do something
}
else {
# do something else
}
or what if you want to match it regardless of case?
$a2 = 'Lambott';
$a3 = 'laMboTt';
lc($a2);
lc($a3);
# Now $a2 eq $a3 because both of
# their values are lower-cased to 'lambott'.
if ($a2 eq $a3) { # Houston, we have a match
# do something;
}
# Note: We could have done uc($a2); uc($a3);
# in which case both values would be 'LAMBOTT'
# because uc converts the string to upper case.
-----Original Message-----
From: Boon Chong Ang [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:33 AM
To: Annie; [EMAIL PROTECTED]
Subject: RE: how to compare to string variables
If($a2 eq $a3) { ...}
else {....}
Is this what you want?
Thank you & best regards,
ABC
-----Original Message-----
From: Annie [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:31 PM
To: [EMAIL PROTECTED]
Subject: how to compare to string variables
I have two strings which I am receiving from two text fields in a form.
I want to compare these...
$a2='Lambott'
$a3='Lambott'
can anyone tell me how i can compare that the string inside a2 and a3 is
similar.
thanks
---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]