Perl language structure: Difference between revisions

Content deleted Content added
m clean up using AWB (9987)
m clean up using AWB (10034)
Line 81:
 
For example, if <code>$name</code> is <code>"Jim"</code>:
 
<ul>
<li>*then <code>print("My name is $name")</code> will print <code>"My name is Jim"</code> (interpolation within double quotes),</li>
<li>*but <code>print('My name is $name')</code> will print <code>"My name is $name"</code> (no interpolation within single quotes).</li></ul>
 
To include a double quotation mark in a string, precede it with a backslash or enclose the string in single quotes. To include a single quotation mark, precede it with a backslash or enclose the string in double quotes.
 
Strings can also be quoted with the <code>q</code> and <code>qq</code> quote-like operators:
<ul><li>*<code>'this'</code> and <code>q(this)</code> are identical,</li>
<li>*<code>"$this"</code> and <code>qq($this)</code> are identical.</li></ul>
 
Finally, multiline strings can be defined using [[here document]]s: