1 # one 1.2 # one and two tenths 6.02e-23 # Avagadros number (6.02 times 10 to the -23 power) 1.0E6 # One million -5.3 # Negative 5 and 3 tenths 1234567.890 # Just what it appears
'hello' # hello 'hello world' # hello, a space, and world 'Hit the \\ key to continue' # Hit the \ key to continue 'Perl\'s Diner' # Perl's Diner 'Hello \nWorld' # Literally Hello \nWorld (no internal newline) 'Welcome To Perl' # Welcome, newline, To, newline, Perl.
"hello world\n" # hello, a space, and world, then a newline # The word Ding, an exclamation point, # and the ASCII character with octal value 007 "Ding! \007" "one\ttwo\tthree" # One, a tab, two, a tab, and three
| Escape Sequence | Effect |
|---|---|
| \n | Newline (correct for your system) |
| \r | Carriage return |
| \t | Horizontal tab |
| \f | Form feed |
| \b | Backspace |
| \a | Bell |
| \e | Escape |
| \007 | Character corresponding to any octal value (octal 7 = bell) |
| \x4a | Character corresponding to any hexadecimal value (hex 4a = "J") |
| \cN | Any control character (here ctrl-N) |
| \\ | Backslash ("\") |
| \" | Double Quote (""") |
| \l | Lowercase next letter |
| \L | Lowercase all following characters until \E |
| \u | Uppercase next letter |
| \U | Uppercase all following characters until \E |
| \Q | Backslash-quote all non-alphanumerics characters until \E |
| \E | Stop \L, \U, \Q |