in reply to Can't include a HEREDOC within RHS of a Regex

The parser needs to find the end of the s/// operator to find the flags before it even tries to parse the replacement expression as code. That means the lexer points to the end of the substitution operator when the heredoc is first encountered. That is why the parser looks after the substitution for the heredoc body, as shown in Re^2: Can't include a HEREDOC within RHS of a Regex.
  • Comment on Re: Can't include a HEREDOC within RHS of a Regex

Replies are listed 'Best First'.
Re^2: Can't include a HEREDOC within RHS of a Regex
by wind (Priest) on Jun 17, 2011 at 22:32 UTC

    Should this be reported as a bug?

    I understand the "why" and there definitely isn't a big need for this type of functionality. However, the RHS of a regex should behave like any other eval block in my opinion.

    The last time I found a bug you reported it for me. Should this one be reported as well?

    I only discovered this while helping someone else on a different forum, so I don't foresee any lost sleep for anyone if this isn't fixed. It also might introduce new problems given there is a "work around" that might've used by others in the past. Can't say which action would be best.

      I don't see what could be done about it, really. Maybe a documentation fix? But I think that would clutter up the docs more than anything.
        Maybe a documentation fix?

        I think, at least an extra test in the test suite demonstrating a working heredoc in RHS :)