$p="horraen=sumsel\[13\]\)\n";
$m="sumsel\[13\]";
The above are exactly equivalent to
$p="horraen=sumsel[13])\n";
$m="sumsel[13]";
If you really want backslashes in the strings you need to double them or use single quotes.
$p="horraen=sumsel\\[13\\]\\)\n";
$m="sumsel\\[13\\]";
..or..
$p='horraen=sumsel\[13\]\)' . "\n";
$m='sumsel\[13\]';
Actually since $m is a regex it's more ideomatic to use qr// unless there's a reason you can't. Also I don't think you really wanted backslashes in $p.
$p="horraen=sumsel[13])\n";
$m=qr/sumsel\[13\]/;