On 5/7/07, Robert Hicks <[EMAIL PROTECTED]> wrote:
snip
I think part of the problem is the 'shift'ing that I was doing. I am
looking into that. Basically I was shift'ing the @log out of existence
after the first pass.
snip

That sounds like a viable candidate for the warning as well.


snip
> Also, you should never use a straight string in a regex; it should
> aways be quoted.
>
> $line = shift @log until $line =~ /\Q$prime_id\E/;

What does that give you? I have never heard of that and have never had a
problem the way I have shown. Just curious...
snip

The \Q turns off meta-characters until the \E.  If your substr returns
"foo.id" then /$prime_id/ will match "foolid" as well as as "foo.id".
Worse yet if substr returns "abc+de" then /$prime_id/ won't match
against "abc+de" only "abcde", "abccde", etc.  And the worst is
unmatched open/close characters.  Try this

perl -le '$smiley = ":)"; print $1 if $smiley =~ /($smiley)/;'

versus this

perl -le '$smiley = ":)"; print $1 if $smiley =~ /(\Q$smiley\E)/;'

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to