September 2017
Beginner
402 pages
9h 52m
English
The x binary operator is a string repetition operator. It repeats a string the given number of times, as seen in the following example:
my $string = 'Developers ';say $string x 5;
This code prints the string containing the initial value of the $string variable five times. The original value is not changed, obviously.
To modify the string and to save the result in the same variable, use the assignment form of the operator:
$string x= 2;say $string;
Now, the $string value is twice as long as it was before.
Read now
Unlock full access