Dearest Monks,

I am having an issue with comparing two strings that should be identical with each other using 'eq'. I am pulling one string from my database (it was previously retrieved) and the other from the web. It works most of the time, but seems to fail under circumstances where, among other things, there are brackets (). Quotemeta doesn't seem to help.

Failed and Successful strings (i.e. headlines) are below code.

Here is the relevant code:

$header =~ s/^\s+//; #remove leading spaces $header =~ s/\s+$//; #remove trailing spaces $header_in_db =~ s/^\s+//; #remove leading spaces $header_in_db =~ s/\s+$//; #remove trailing spaces if ($header eq $header_in_db) { $Already_in_DB = 1; print "<b>ALREADY IN DATABASE</b><br>"; }

Failed matches:

Genetic Variants of Wnt Transcription Factor TCF-4 (TCF7L2) Putative Promoter Region Are Associated with Small Intestinal Crohn's Disease

Conserved Protective Mechanisms in Radiation and Genetically Attenuated uis3(-) and uis4(-) Plasmodium Sporozoites

MaxCyte Introduces the GT(TM) Flow Transfection System for Application with Autologous and Allogeneic Stem Cell Therapies

Update of Long-Term Data on Brain Cancer Patients Receiving DCVax(R)-Brain Continues to Show Striking Improvements in Delay of Disease and Survival

Dengue Virus Type 2 Infections of Aedes aegypti Are Modulated by the Mosquito's RNA Interference Pathway

Relation of DNA Methylation of 5′-CpG Island of ACSL3 to Transplacental Exposure to Airborne Polycyclic Aromatic Hydrocarbons and Childhood Asthma

Successful Matches:

Wayne County Partners With TechTown to Launch Global Stem Cell 'Innovation and Commercialization Lab'

Genes That Control Body's Salt Levels Are Identified

Push is on to tailor cancer care to tumor's genes

Eye Movement: Involuntary Maybe, But Certainly Not Random

Top 5 Fast-Growth Stocks for Feb. 16

Discovery of a Novel Activator of KCNQ1-KCNE1 K+ Channel Complexes

Most Humbly,

Chris Herold

In reply to 'eq' matching not comprehensive by cdherold

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.