qq/STRING/ Function of Regular Expression in Perl

What is qq/STRING/ Function in Perl?
How to interpolate variables?


The qq/STRING/ function of regular expression in perl is used to interpolate all variables but ignores double quotes, this is usefull while printing html tags which requires lot of doublequotes for each tag, this can be solved by using "qq/string/", user can use any delimiters instead of "/".



Example to interpolate variables:

#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
print qq^I love india<br>I love the world^;
Result :

I love india
I love the world

In the above example we have used "^" as the delimiter for "qq/string/" and even though the strings and the html tag <br> is without double quotes, it assumes having double quotes and print the string in two different lines.

Ask Questions

Ask Question