http://www.perlmonks.org?node_id=1026200


in reply to Re: logic within interpolation
in thread logic within interpolation

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.

Replies are listed 'Best First'.
Re^3: logic within interpolation
by kennethk (Abbot) on Mar 29, 2013 at 22:18 UTC
Re^3: logic within interpolation
by hexcoder (Curate) on Mar 30, 2013 at 18:57 UTC
    do you want to do this?

    eval "qq{$interpol}"