in reply to Using vars in a var
There is nothing magical about the database portion of this; it's just a distraction. If $htmlvar contains what you want it to, it will contain that whether you print is value or UPDATE it into a text-based field in a database using placeholders and execute(). So set up a test that eliminates the confusion of the database.
my $price = "50"; my $htmlvar_qq = "<li>The price is \$$price</li>"; my $htmlvar_q = '<li>The price is \$$price</li>'; print "$_\n" for $htmlvar_qq, $htmlvar_q;
The output will be:
<li>The price is $50</li> <li>The price is \$$price</li>
In response to your question someone suggested that you probably were using single quotes. You followed up by stating that you tried with double quotes also, and still had the problem. If that's the case, please provide code that exhibits the incorrect behavior while printing to STDOUT rather than updating into a database. If it really only happens when updating into the database, please provide an example where you are printing to STDOUT and updating into the database, and getting something different in the database than what you see on STDOUT.
Dave
|
---|