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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing a colon

Status
Not open for further replies.

XeNoR

Programmer
Jun 1, 2002
6
US
does anyone know how to print a colon?

for example:
print '<head><style>{ font-family:arial;font-size:30px}</style></head>';

clearly, this does not work because of the colon in the text. is there a way to have perl print special characters? help would be appreciated.

-XeNoR-
 
eee
like this

print ';';
or
print &quot;;&quot;;

a colon is not a character that need &quot;escaping&quot;
example
print &quot;\\&quot;; # will print print &quot;\'&quot;; # will print '
etc

diference between ' and &quot; check this out
#!perl -w
use strict;
my $var = &quot;somevalue&quot;;
print '$var'; # will print $var
print &quot;$var&quot;; # will print somevalue

hope this helps ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
so instead of this: print '<style>{font-family:arial;font-size:30px}';

i have to put this: print '<style>{font-family:arial', ';', 'font-size:30px}';

???
 
I don't understand. This will work just fine:

print '<head><style>{ font-family:arial;font-size:30px }</style></head>';

Why do you say it's not working becuase of the colon?

By the way.
: is a colon.
; is a semi-colon.

Just wanna make sure we are all on the same page.

--jim
 
Actually, because you have the text that you are printing in single quotes your original print statement will work. When you said &quot;clearly, this does not work&quot; had you actually tried it?

The only character that is special inside single quotes is another single quote (or apostrophe).

jaa
 
Hmmm. That's the other coast for me. If you ever fly out to the D.C. area, let me know. And of course, bring a parachute. I heard on the news the other day the the crazies have gotten some shoulder-mounted-rocket-launchers into the country. [chills_up_spine]

--jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top