As per Regexp Quote Like Operators, /ee means "Evaluate the right side as a string then eval the result." and "A /e will cause the replacement portion to be treated as a full-fledged Perl expression and evaluated right then and there. It is, however, syntax checked at compile-time. A second e modifier will cause the replacement portion to be evaled before being run as a Perl expression."

So basically, "$rhs" becomes qqq, which when evaled causes an error: Try adding print $@ to your code and you'll see Bareword "qqq" not allowed while "strict subs" in use at (eval 1) line 1., so eval is returning undef which is causing the Use of uninitialized value in substitution iterator.

Running perl -e 'print eval("qqq");' prints qqq.

That's because that's not using strict - perl -wMstrict -e 'print eval("qqq"); print $@;' prints Bareword "qqq" not allowed while "strict subs" in use at (eval 1) line 1.

And of course there's no warning with just /e instead of /ee; in the real program, I need /ee.

Perhaps your example is a little too abstracted from the original program? Needing /ee is somewhat rare in my experience. Could you show a more representative example of why you (think you) need it, perhaps we can come up with a better solution?


In reply to Re: /ee -> Use of uninitialized value in substitution iterator (without back references) by haukex
in thread /ee -> Use of uninitialized value in substitution iterator (without back references) by karlberry

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.