Perl: String Operations
Substring
substr(string, offset, count)
.
# -*- coding: utf-8 -*- # perl print substr('012345', 0, 2); # "01"
String Length
Length of string is length(string)
.
print length('abc');
String Join and Repetition
use dot to join string.
# -*- coding: utf-8 -*- # perl $s = "a" . "b"; print $s; # ab
String repetition is done with the operator x
.
# -*- coding: utf-8 -*- # perl print 'abc' x 2; # abcabc