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

Nichodemus has asked for the wisdom of the Perl Monks concerning the following question:

I am relatively new to Perl -- I figure there must already be a way to do this without writing my own custom subroutine. Here's my question:

How can I force a scalar variable to be re-interpolated?

For example, lets say that this line of code:

print $raw;

returns:

fred has $color eyes

What I want to be able to do is later set $color to equal "blue." And then have:

$parsed = # ??? something to re-interpolate $raw

print $parsed;  # I get the text "fred has blue eyes"

Anyone have any ideas?

-Nich