in reply to Code that contains </code>

Simplest answer: Don't use code tags in your code ;-)

It's a little screwy looking but you simply need to break apart the closing code tag.
<code>my $code = '<code></code</code><code>>';</code> results in:
my $code = '<code></code>';
exhibits break in multi-line code blocks :(