use strict; use warnings; use 5.010; # From https://perldoc.perl.org/5.30.1/functions/split.html: # and each of these: print join(':', split(//, 'abc', 3)), "\n"; print join(':', split(//, 'abc', 4)), "\n"; # produces the output a:b:c __DATA__ Output: a:b:c a:b:c: