$ perl -MData::Dump -Mre=debug -le " dd( $_=qq{a\n\nb} ); s{^$}{boop}m; dd( $_ ); "
Compiling REx "^$"
Final program:
1: MBOL (2)
2: MEOL (3)
3: END (0)
anchored ""$ at 0 anchored(MBOL) minlen 0
"a\n\nb"
Matching REx "^$" against "a%n%nb"
0 <> | 1:MBOL(2)
0 <> | 2:MEOL(3)
failed...
2 <%nb> | 1:MBOL(2)
2 <%nb> | 2:MEOL(3)
2 <%nb> | 3:END(0)
Match successful!
"a\nboop\nb"
Freeing REx: "^$"