Node:Interpolation in Double-quoted Strings, Next:, Previous:Double-quoted Strings, Up:Double-quoted Strings

Interpolation in Double-quoted Strings

Interpolation is a special process whereby certain special strings written in ASCII are replaced by something different. In Single-quoted Strings, we noted that certain sequences in single-quoted strings (namely, \\ and \') were treated differently. This is very similar to what happens with interpolation. For example, in interpolated double-quoted strings, various sequences preceded by a \ character act different.

Here is a chart of the most common of these:

String Interpolated As
\\ an actual, single backslash character
\$ a single $ character
\@ a single @ character
\t tab
\n newline
\r hard return
\f form feed
\b backspace
\a alarm (bell)
\e escape
\033 character represented by octal value, 033
\x1b character represented by hexadecimal value, 1b