18.104.22.168 Newlines in Single-quoted Strings
Note that there is no rule against having a single-quoted string span
several lines. When you do this, the string has newline
characters embedded in it.
A newline character is a special ASCII character that indicates that a
new line should be started. In a text editor, or when printing output
to the screen, this usually indicates that the cursor should move from
the end of the current line to the first position on the line following
Since Perl permits the placement of these newline characters directly
into single quoted strings, we are permitted to do the following:
start anew.'; # Represents the single string composed of:
# 'Time to' followed by a newline, followed by
# 'start anew.'
This string has a total of twenty characters. The first seven are
Time to. The next character following that is a newline. Then,
the eleven characters,
start anew. follow. Note again that this
is one string, with a newline as its eighth character.
Further, note that we are not permitted to put a comment in the middle
of the string, even though we are usually allowed to place a `#'
anywhere on the line and have the rest of the line be a comment. We
cannot do this here, since we have yet to terminate our single-quoted
string with a `'', and thus, any `#' character and comment
following it would actually become part of the single-quoted string!
Remember that single-quotes strings are delimited by `'' at the
beginning, and `'' at the end, and everything in between is
considered part of the string, included newlines, `#' characters
and anything else.