in reply to pattern matching: why does the following code evaluate true? (and how do i fix it?)

That's not greedy pattern matching. That's just an example of the '.' matching any character (except newlines).

To the OP: the regex matches because the '.' matches an "I" character. Because '.' matches anything. Read perlre.

And try this, if you wanted a literal period ('.'):

if ($key =~ m/\Q$key2\E/) { print " [just another perl hacker] \n"; }
  • Comment on Re: pattern matching: why does the following code evaluate true? (and how do i fix it?)
  • Download Code