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^			$bodyText		^;

In this example, I’ve used ^ for a delimiter, but you can use anything you want.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: