Perl has two operators related to String scalar types.
- Concatenation, Symbol is
- String Repetition Operator, Symbol is
These operators helps developers to manipulate and process the string data.
$str1 = "one"; $str2 = "two"; $result = $str1." ".$str2; print "$result";
String Repetition Operator
x, a;sp called Repetitation that repeates the given string n times
strVariable x n
It contains left and right operands for an operator. left is repeated by right side value.
striVariable value is repeated n times .
$str1 = "one"; $result = $str1 x 3; print "$result";
Other String operators
What are the string operators in Perl?
String operators are used to manipulate string scalar values in perl. It contains two operators in Perl
- Concatenate (
.), that conatenate one string to end of another string.
- repetition (x), that repeates the string multiple times.