On May 18, Paul said:

> @hits = grep /^$TEST1$/, @HOLDER;

Do not use a regular expression to check for equality.  It breaks far too
often.

  * the $ anchor does not match the end of the string -- it matches the
    end of a string OR before a newline at the end of a string
  * if $TEST1 has any regex characters in it, the regex might break, or
    succeed or fail when it shouldn't

The "proper" regex is /^\Q$var\E\z/.  That's noisy.  Don't use it.

  @equal = grep $_ eq $wanted, @original;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
*** I need a publisher for my book "Learning Perl Regular Expressions" ***

Reply via email to