Scalar Data

Single-quoted strings

In single-quoted strings there is no backslash escape and variable interpolation.

(Try substitute double quotes with single quotes in table.pl and in students1.pl).

To have a literal single quote or a literal backslash, precede them with a backslash.

Example (single_quotes.pl):

#!/usr/bin/perl

$a = 'Noa';

$b = 'In single quotes (\') backslash (\\) does not affect escape characters (i.e. \n) and variables (i.e. $a) are not interpolated.';

print "$b\n";

Result:

In single quotes (') backslash (\) does not affect escape characters (i.e. \n) and variables (i.e. $a) are not interpolated.


Table of Contents.
Previous | Next.