...; my $substituted_text = eval("\"$text\""); die "Variable Substitiution failed: '$@'" if $@; print $substituted_text;