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

Quick question for the perlmonks masters. I am working on with a product database that will include the price of the products. How can I use the dollar sign in a .pl script without it giving me an internal error?
if ($data{$id}{'Name'} ne "") { print "<br><font face='$font_face' size=$font_size><SMALL> $da +ta{$id}{'Name'}<BR></SMALL></FONT><font color=red size=+1>(Dollar Sig +n Here?)$data{$price}{'Price'}";

Replies are listed 'Best First'.
Re: Adding A Dollar Sign
by Fastolfe (Vicar) on Jan 13, 2001 at 21:32 UTC
    To use special characters within double-quotes, you need to 'quote' it with a backslash.
    print "The price for $product is \$5.00.\n";
    You can also use single-quotes to avoid most all special characters.
    print 'The price is $5.00.', "\n";
    You maybe interested in reading things like perlop or an introductory book in Perl regarding stuff like this.
Re: Adding A Dollar Sign
by monk2b (Pilgrim) on Jan 13, 2001 at 21:44 UTC
    Finally a question I have the answer to and someone beats me to it.
    print '$200.00' . "\n"; or print "\$200.00\n";

    learning also

      In your first example, rather than a period, you can use a comma to pass print a list and avoid that (admittedly not all that expensive) concatenation:

      print '$200.00', "\n";