Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Mar 10, 1999

The qq Function for Long Strings in Perl

If you write CGI programs in Perl, you probably find yourself using a lot of long print statements for outputting HTML. HTML uses a lot of double quotes, so it's better if you don't have to escape every " you use. You can accomplish this with the qq function, which will interpolate all variables but ignores double quotes. For example:
 
print qq^
	<HTML>
	<BODY BGCOLOR="#FFFFFF" LINK="#003366" VLINK="#666666">
	$bodyText
	</BODY>
	</HTML>
^;
In this example, I've used ^ for a delimiter, but you can use anything you want.
Steve Renaker
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap