Perl String Escaping CharactersAll the special characters or symbols like @, #, $, & /, \, etc does not print in a normal way. They need a preceding escaping character backward slash (\) to get printed. Perl Displaying E-mail AddressAll the e-mail addresses contain (@) sign. As stated earlier, symbols will not be printed normally inside a string. They need extra attention. Use backward slash (\) before @ sign to print e-mail addresses. Output: Perl $ sign Embedding in Double quote StringIf we want to print ($) sign inside a string, use backward slash (\) preceding $ sign. Output: We have defined $msg1 as Ana Perl Escaping Escape CharacterIf we want to print (\) sign inside a string, use backward slash (\) preceding \ sign. Output: Everyone has to follow this rule whether its a boy\girl Perl Escaping Double quotesIf you want to print double quotes inside a string use backslash (\) at both the quotes. Output: Our site "javaTpoint" provides all type of "tutorials? Perl Double-q Operator, qqThe "qq" operator replaces the double quote surrounding a string by its parentheses. It means ("") are not essential on this string anymore. It will simply print the string with qq. But if you want a bracket inside a string then you need to use curly braces {} surrounding the string. And if you need curly braces inside the string then use square bracket [] surrounding the string. Output: Our site "javaTpoint" provides all type of "tutorials" Our site (javaTpoint) provides all type of "tutorials" Our site (javaTpoint} provides all type of "tutorial" Perl Single-q Operator, qThe single 'q' operator works as the single quote (') in the string. Like single quote, it also does not interpolate the variables. Output: Our site "javaTpoint" provides all type of "$x"\n Our site "javaTpoint" provides all type of "$x" \n Our site )javaTpoint( provides all type of "$x" \n Our site )javaTpoint} provides all type of "$x" \n Next TopicPerl Modules and namespaces |