in reply to logic within interpolation

Any thoughts?

use a hash, see String::Interpolate/ String::Interpolate::RE , String::Defer, Interpolation, Template,Text::Xslate... Re^2: Write to existing file with character insert, perlrequick

Replies are listed 'Best First'.
Re^2: logic within interpolation
by karrakis (Novice) on Mar 29, 2013 at 22:04 UTC
    the problem actually lies in the 'nesting' of the interpolations being done.

    ${if(this){return 'this';}} is fine, because the single quotes do not result in this during eval:

    eval ""this""; <- problem.

    eval "'this'"; <- evaluated properly.

    So the problem is I need to find a way to interpolate the contents of $1 and *then* have those contents interpolated again. I think I'm on the right track now, but thanks for the boilerplate, some of that looks to be useful reading.

      do you want to do this?

      eval "qq{$interpol}"

Re^2: logic within interpolation
by McA (Priest) on Mar 29, 2013 at 21:40 UTC

    You must have a copy & paste buffer dedicated to this answer... ;-)