Because your var ($p) contains a backslash follows by a square bracket (\[). $m gets interpolated in the RE, so in the first case, the \[ will be interpolated as only a square bracket, and you lose the backslash.
Paul
Comment on Re: regexp matching with "\[" in the substring to be matched