The fact is that /e is only applicable to the right-hand-side of a s/// operator.

Please see my clarification(s) to my original post on this thread. I'm quite aware of (although I was somewhat taken aback by) the current behavior.

I was looking for others' opinions on this idea. And I've gotten some (mostly indifferent to negative, alas).

It seems that what I really want is a way to apply qr to an expression without having to stick it into a variable first. Upthread someone suggested an explicit Regex->new( EXPR ) syntax; my response was to just use qr->( EXPR ). (Sigh, that would break if someone used hyphens as the non-alphanumeric delimiters...)

(This is, in my mind, a similar situation that \Q and \E found themselves in; being able to escape metacharacters is useful even outside of double-quoted interpolation, so quotemeta is available as a standalone. Hm. Maybe quoteregex is where it's at? Although introducing a new keyword is probably not going to happen...)

You're talking, it seems, about allowing the actual RE portion to be eval{...}'ed prior to the execution of the RE.

I realize that it could seem that way, but my request for /e is much closer in spirit to /o than to any of the other match modes. I would only want the /e to apply when qr// is compiling the expression: it would tell qr that the text inside the brackets should be evaled to return a string, as opposed to interpreting the text between the brackets as a value to be double-quote interpolated to return a string. (This is why it seems to resonate with s///e, as the modifier is saying exactly the same thing about the replacement text.)

Anyway. It's absolutely not necessary, I was just curious what other people thought of the idea. Thanks for your feedback!


In reply to Re: Re: qr// with /e? by tkil
in thread qr// with /e? by tkil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.