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:
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 29, "Functions". Most often, though, people do their concatenation implicitly inside a double-quoted string:$almost = "Fred" . "Flintstone"; # returns FredFlintstone
$fullname = "$firstname $lastname";
Copyright © 2001 O'Reilly & Associates. All rights reserved.
HIVE: All information for read only. Please respect copyright! |