|
Adding Strings
To add strings, special operators are used. To combine
2 strings, you must use the . operator for the concatenation.
The following table outlines the different accumulating operators
used widely in perl scripts, note:
| . |
Combines
(concatenates) 2 or more strings |
Examples:
|
#
Example 1
$fullname="Brett " . "Roberts";
# Value in $fullname becomes Brett Roberts
# Example 2
$firstname="Brett ";
$lastname="Roberts";
$fullname=$firstname . $lastname;
print "Hello $fullname!";
# This will display output of Hello Brett Roberts!
|
|