print "normal string"; # normal string
print "two\nlines"; # two
# lines
print "another 'string'"; # another 'string'
my $name = "Foo";
print "Hello $name, how are you?"; # Hello Foo, how are you?
print "His "real" name is Foo"; # ERROR
print "His \"real\" name is Foo"; # His "real" name is Foo
print "His \"real\" name is \"$name\""; # His "real" name is "Foo"
print qq(His "real" name is "$name"); # His "real" name is "Foo"
print qq(His "real" name is ($name)); # His "real" name is (Foo)
print qq{His "real" name is ($name)}; # His "real" name is (Foo)In double quoted strings you can use the following:
Backslash escapes sequences like \n \t
see in perldoc perlop
Variable interpolation
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| String functions | Up | Strings - Single quoted |