Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escaping '$'

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
How do I do this?

tHANKS
 
Escaping the dollar sign is just like escaping any other character - just put a backslash before it, like:

print "\$var1 = $var1\n";

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Oh... because I'm making it like $1,000, and it now looks like \$1,000 and it still doesn't work.

Do I have to escape the "," also?
 
hmerrill's '\' escape works with a double-quoted string.
You don't need to escape a '$' inside a single-quoted string.
Code:
print '$1,000';
print "\n";
print "\$1,000";
print "\n";
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top