Archive for the ‘Perl’ Category
Perl Strings
15/03/2011
Leave a comment
'Hello World!' # Returns 'Hello World!', supports escaping of ' and \ 'It\'s\\It is' # Returns 'It's\It is' 'Don\'t "escape"' # Returns 'Don't "escape"' 'Hello\nWorld!' # Returns 'Hello\nWorld!'
"Hello World!" # Returns 'Hello World!', supports escaping multiple # characters, including \n and \t, and interpolation "Hello\nWorld!" # Returns 'Hello # World!'
'Hello' . ' ' . 'World!' # Returns 'Hello World!'
$hi = "Hello"; # The two types of interpolation are equivalent. The first type is used # for variable names that would cause ambiguity. "${hi} World!" # Returns 'Hello World!' "$hi World!" # Returns 'Hello World!'
Categories: Code, Perl, Programming for Programmers
concatenation, interpolation, perl, strings