Strings
Double-quote strings
- Similar to a C string
- Interpolates (expands) variables within the string (i.e.
"$var1")
Backslash escapes
\" Double quote
Single-quote strings
- Any character is legal within the string
(including newline
characters, if the string spans multiple lines), except for single
quotes and backslashes.
- Does not interpolate (expand) variables
within the string (i.e.
'$var1')
Backslash escapes
\' Single quote
\\ Backslash
Back-quote strings
- The string text is run as a separate
process; output is
redirected and stored in the string
Functions
length
length(STRING)
- Returns the length of the string
(parentheses are optional)
substr
substr(STRING, OFFSET [, LENGTH])
- Returns a substring
(offset is 0-based) (parentheses are optional)
chomp
chomp(STRING)
- Removes the trailing newline character from
the string (if there is one).
chop
chop(STRING)
- Removes the last character from the string.