A string is a sequence of bytes (characters) enclosed in quotes. : String « String « Perl






A string is a sequence of bytes (characters) enclosed in quotes.

     

#The following shows three ways to quote a string:

#    Single quotes: 'It rains in Spain';
#    Double quotes: "It rains in Spain";
#    Here document:
#            print <<END;
#                   It
#                   rains in
#                   Spain
#            END

$question = 'wouldn\'t mind';        # Single quotes
$answer = '"No."';                   # Single quotes
$line = "\t it isn't \n";
$temperature = "78";
print "It is currently $temperature degrees";
# Variables are interpreted when enclosed in double quotes, but not single quotes

   
    
    
    
    
  








Related examples in the same category

1.String Operations
2.String Operators: the right and wrong ways to perform an equivalence check on a string:
3.String plus
4.String variable
5.Strings are normally delimited by a matched pair of either double or single quotes.
6.ASCII Character Codes
7.Calculation on string
8.Use print to output string
9.Append two string value
10.Perl 5 String Functions
11.Using ~ operator to check if a scalar is a string type variable
12.String Literals
13.String operators
14.String value reference