February 2012
Intermediate to advanced
1184 pages
37h 17m
English
Strangely enough, Perl also has the customary + (addition) and – (subtraction) operators. Both operators
convert their arguments from strings to numeric values, if necessary, and
return a numeric result.
Additionally, Perl provides the .
operator, which does string concatenation. For example:
my $almost = "Fred" . "Flintstone"; # returns FredFlintstone
Note that Perl does not place a space between the strings being
concatenated. If you want the space, or if you have more than two strings
to concatenate, you can use the join
operator, described in Chapter 27. Most often, though,
people do their concatenation implicitly inside a double-quoted
string:
my $fullname = "$firstname $lastname";
Read now
Unlock full access