in reply to Confusing regex match.

I can reproduce what you describe. Firstly, two text files which only contain the string 'pl'.

$ cat junk pl
$ cat junk2 pl

One matches your regex, the other doesn't:

$ perl -nE 'say +(/p.{2,6}/) ? "match" : "no match"' junk match
$ perl -nE 'say +(/p.{2,6}/) ? "match" : "no match"' junk2 no match

A closer look inside the files explains why.

$ cat -vet junk pl^M$
$ cat -vet junk2 pl$

[In case you're unfamiliar with the command, cat -vet, displays carriage returns as "^M" and newlines as "$".]

-- Ken