in reply to Re^3: Bad code from the trenches
in thread Bad code from the trenches

Huh. Interesting ... is there a way to force interpolation of the text in $x?

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^5: Bad code from the trenches
by Joost (Canon) on Mar 14, 2005 at 14:08 UTC
      I meant "accidentally". eval STRING is rarely done by accident. :-)

      Being right, does not endow the right to be rude; politeness costs nothing.
      Being unknowing, is not the same as being stupid.
      Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
      Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

        There is no other way to force it, except the usual things that imply eval, like writing the string to a file and then require()ing it, using the string in the replacement part of a s///e expression, etc.

        Note that the (?{ code }) constructs in regexes are also safe from interpolation in /$regex/ except when you explicitly use re 'eval'