in reply to Multiple line regex match

Instead of .*?, you can also use [^<]* It might even be more efficient (due to smaller amount of backtracking), but I'm not sure about that.

if ($request->content =~ m! <tr> \s* <td[^>]*> \s* <p>Transaction Number:</p> \s* </td> \s* <td[^>]*> \s* ([^<]+) \s* </td> \s* </tr> !xs) { print "\nmatched $1\n"; }