in reply to Matches but not substituting

It would be easier to diagnose if you provide a self-contained code sample that anyone can run. Regardless, my best guess is that
$Text =~ s/$Find$/$Link/g;
should be:
$Text =~ s/$Find/$Link/;
If LOC100282561 is not at the end of the $Text string, then the $ anchor prevents the substitution.

Update: with your updated code and my proposed fix, here is the output I get:

<a href="http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&term=LOC1002 +82561" target="_blank">LOC100282561</a> [Source:RefSeq peptide;Acc:N +P_001148941]
Is that what you expect?

Replies are listed 'Best First'.
Re^2: Matches but not substituting
by seaver (Pilgrim) on Jun 03, 2011 at 15:14 UTC

    Oh boy, I knew the answer would be obvious! That "$" was a typo introduced many moons ago, but for the first time, I had to parse text that didn't have the match at the end of the string, so it never threw up on me until now.

    Thanks for pointing it out, problem solved, phew! I was really hitting my head on the desk over this one.

      This sounds like an excellent time to introduce a test suit for the script. Actually any time is an excellent time to introduce unit tests, but right now is mostly the best time.

      True laziness is hard work
Re^2: Matches but not substituting
by Anonymous Monk on Jun 03, 2011 at 14:55 UTC
    Maybe $Text =~ s/\Q$Find\E/$Link/g;
      \Q and \E are not needed here because the only characters in the regular expression part of s/// are LOC0123456789, and none of those is a metacharacter.