in reply to Re^2: Sort of basic search engine/pattern matching problems
in thread Sort of basic search engine/pattern matching problems

I'm not a master of regex's (yet?) but I think I see the problem...
if ($line =~ /^$query_el\]\[.*/i) {
Remember that $ has special meaning inside a regex (end of line). I *think* that you need to use the qr operator before the regex to evaluate the contents of $query_el before you perform the regex. Someone please correct me if I'm wrong here.

Replies are listed 'Best First'.
Re^4: Sort of basic search engine/pattern matching problems
by graff (Chancellor) on Apr 30, 2010 at 09:18 UTC
    When you're not sure, you should try it yourself and find out, rather than posting a guess. As it happens, you are wrong in this case: perl interpolates the variable $query_el into the regex.