in reply to multi line pattern match

Use multi-line matching like this:
m/^regex$/m
The last m after regex turns on your "multi-line mode". Hope this helps.