-----Original Message-----
From: Krishna, Hari [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 29, 2003 12:57 PM
To: [EMAIL PROTECTED]
Subject: string compare


Friends,

I have two string
$m1="hari$";
$t1="HaRi$";

How do I compare irrespective of the case?

Since they are strings, I have to use 'eq' as comparison operator.

        if ($m1 eq $t1) -- doesn't work as it looks at the case
$m1 eq m/$t1/i ---- I know m// is used to match a string against a
regular
expression.
$m1 eq ~/$t1/

.............

Thanks for any help.

Hari..
-------------------

Save on processing speed.

Force them both to upper case to compare:

if (uc($m1) eq uc($t1)) {
  print "They match\n";
} else {
  print "They don't match\n";
}

Stan
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to