RT #119125: fix two issues with/[#]/x

(This is a maint-specific patch, not a cherry-pick from blead)

A hash within a character class in an expanded pattern is an odd beast.
It is handled twice, first by the perl toker, which is looking for
things like embedded variables that need interpolating, and second by the
regex parser. The toker only has limited knowledge of regex syntax,
and struggles to work out for things like /#$foo/x and /[#$foo]/x,
whether that's a regex comment and so whether '$foo' is part of the
comment string or a variable to be interpolated.

Up until 5.18.0 inclusive it got very confused when the '#' was within a
character class, and usually got it wrong. 5.18.0 also introduced the
additional complication that (?{}) code-blocks were now normally handled
by the perl toker rather than by the regex parser. A side-effect of this
was that if for any reason the toker didn't spot a code block (because it
erroneously thought it was part of regex comment for example), then the
literal code block text would be passed through uncompiled to the regex
parser, which would then refuse to compile unless "use re eval" was in
scope.

Al these problems have been fixed in blead. However, the fixes couldn't be
fully back-ported to maint, since there was a fair bit of code on CPAN
that would (erroneously) do things like /[#$^]/ which the author expected
to match one three special characters, and indeed does on on older perls.
On bleed however, this (correctly) expands to /[#STDOUT_TOP]/ (based on
what $^ is currently set to). So we decided to keep the old (broken)
behaviour on maint.

These fixes and half-fixes were included in 5.18.2. However, it turns
out that 5.18.2 still has a couple of issues, one of which is a regression
from 5.16.x. The table below shows the behaviours of certain regex
constructs under various flavours of perl. "5.18.3" represents the changes
included in this commit, and the entries marked "*******" represent
changes in behaviour since 5.18.2 (i.e. they are what this commit fixes).

/[#$b]/x

    5.16.3 - $b not expanded
    5.18.0 - $b not expanded
    5.18.2 - $b not expanded - keep bug for backwards compatibility
    5.18.3 - $b not expanded - keep bug for backwards compatibility
    blead  - $b expanded

/[#]$c/x

    5.16.3 - $c not expanded
    5.18.0 - $c not expanded
    5.18.2 - $c not expanded
    5.18.3 - $c expanded *******
    blead  - $c expanded

/[#]
(?{})/x   # i.e. this pattern includes a literal newline

    5.16.3 - re eval not needed
    5.18.0 - re eval needed
    5.18.1 - re eval needed
    5.18.2 - re eval needed
    5.18.3 - re eval not needed *******
    blead  - re eval not needed