Forum Moderators: coopster & phranque

Message Too Old, No Replies

Writing to a CGI file including $ signs

How to write the "$" sign to a file.

         

Mr Anonymous

2:50 am on Sep 27, 2003 (gmt 0)

10+ Year Member



I'm working on something but I need to know how to write the dollar sign ($) character to the file.

e.g.
open(FILEHANDLE,"file");
print FILEHANDLE qq~(the dollar sign here)blah~;
close(FILEHANDLE);

claus

2:56 am on Sep 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can escape them using a backslash, like this (and do the same for at-signs):

\$
\@

Mr Anonymous

10:23 pm on Sep 27, 2003 (gmt 0)

10+ Year Member



Yep, that's what I was looking for. Thanks so much :)
<><

amoore

10:32 pm on Sep 27, 2003 (gmt 0)

10+ Year Member



I notice that you're using the "qq" quote-like operator. That interprets variables, so you have to escape characters like "$" and "@". You can also use the "q" operator, so you can write things like:
print q(cost: $34.00, email sales@example.com);
and the spectial characters will not be interpreted.
The perlop man page [perldoc.com...] has more information.