FreeKB - Perl (Scripting) Append values to a variable (.=)
Perl (Scripting) - Append values to a variable (.=)

Let's say you have a variable that contains fruit.

my $fruit = "banana apple orange grape";


The .= operator can be used to append values to the end of the variable. In this example, pineapple will be appended to the $fruit variable.

$fruit .= "pineapple";


After pineapple has been appended, the variable can be printed.

print $fruit;


The original values in the variable plus pineapple will be printed.

banana apple orange grape pineapple


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 727ff in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |