Thanks for correcting me!  My brain is not in Perl mode - I wanted to
bind the start(^) and end($) of the line in the regex, but I couldn't
remember if I could just stick the $acct2 in the regex, or if it would
think the '$' in $acct2 would signify the end of the line.  Thanks
again.

Hardy

>>> "Brian Campbell" <[EMAIL PROTECTED]> 01/22/04 03:52PM >>>

----- Original Message -----
From: "Hardy Merrill" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 22, 2004 11:21 AM
Subject: Re: Strange matching problem...


> HM>> I don't see any matching logic in your code below, but here's a
> general thought - instead of a string equality check ( if ($acct1 eq
> $acct2) ), you could use a regular expression with the "i" (ignore
case
> flag) something like ( if ($acct1 =~ /$acct2/i )
>

Sorry, that this is a bit off topic but couldn't resist...
This is for the (hopefully small) percentage of readers that are not
fluent
in "regular expressions", and might use this advice in the future.

A better check would be add the anchors ^,$

    if ($acct1 =~ /^$acct2$/i) {
             #do something
   }

In order to get an exact character match.  Otherwise you are checking
to see
if $acct2 is a subset of $acct1.
For example the two strings
   $acct1 = "XABCX";
   $acct2 = "abc";
would match without ^,$


Reply via email to