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

printint <\QUESTION>

Status
Not open for further replies.

Graziella

Programmer
Jul 8, 2004
38
AT
Hi,

print "<QUESTION> $questions <\\QUESTION>";

with the double backslash, does not work. Perl still confuses \\Q with one of its special characters.
How could I print <\QUESTION> ?

Grazia
 
That works for me (ActivePerl 5.8, Windows).

One point though: the string looks like XML, so should that not be a forward-slash instead of a back-slash?
 
That's what I was thinking, too.

print "<QUESTION> $questions <\/QUESTION>";
 
I am using Perl 5.8 in a Unix environment.
It still does not work and I get a funny output.
My line of code is
print "<QUESTION> $ID2questions{$qID} </QUESTION>\n";

And I print out:
</QUESTION>ow far would you run if you participate in a marathon?

a. without <QUESTION>
b. missing first character of the question itself, i.e. it print "ow" instead of "How".

Grazia
 
With this code:
[tt]
$qID='running';
$ID2questions{$qID}=
'How far would you run if you participate in a marathon?';
print "<QUESTION> $ID2questions{$qID} </QUESTION>\n";
[/tt]
I get:
[tt]
<QUESTION> How far would you run if you participate in a marathon? </QUESTION>
[/tt]
 
Hi TonyGroves,

I agree with you that is should print what you get, but it does not do it. I still get the error message.

GRazia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top