q(STRING) Function in Perl

What is q(STRING) Function in Perl?

Explanation

The q(STRING) function is used instead of using a single quotes.

Syntax:


q(string)

In the above syntax, the function takes a "string" as the argument.

Example :


#! C:programfilesperlbinperl
print "content-type: text/htmlnn";
$var =10;
print(q(Hiox India $var));
Result :

Hiox India $var

In the above example the string "Hiox India $var" is printed, since "q/string/" is like using the single quotes variable substitution is not done, so "$var" is printed as a string and not its value "10".

Ask Questions

Ask Question