Dennis, I agree, and it's good that they saw both of these e-mails. Your suggestion is faster and also condenses the script(good things of course)...but newbies need the exposure to the whole TMTOWTDI concept too. :)
I also like your suggestion better because it just ignores the case of the string, rather than changing the case of the string. -----Original Message----- From: Dennis Stout [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:51 AM To: Scot Robnett; [EMAIL PROTECTED] Cc: Boon Chong Ang; Annie Subject: Re: how to compare to string variables > 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'. I'd just modify your first case. instead of if ($a3 =~ /$a2/) { I'd say if ($a3 =~ /$a2/i) { They both work. Just tossing out new ideas for folks to play with :) Dennis
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]