From the course: Perl 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Quote operators

Quote operators - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Quote operators

- [Voiceover] Perl provides a number of alternate quote operators. These are particularly useful in cases where normal quotes may not work easily. And you notice I run this, it says "Hello, World" in the output. Now let's say that I didn't wanna use the quote marks for whatever reason, and we'll talk about reasons in a minute. Instead, I could use the letter Q and a pair of matching characters. So I can use an opening parenthesis here and a closing parenthesis here, instead of the closing quote mark, and save and run, and you'll notice that the output is exactly the same. So what are some reasons that I might wanna do this? Perhaps I wanted to use regular quote marks inside of the string, and so if I do that, now our output says "Hello, World" with the quotes. But if I were to try that with the regular quote marks, I would get an error about a Bareword. Missing operator before World. So that doesn't work. So instead, I can use these alternate quote marks like this, and the output is…

Contents