in reply to Splitting a String into n-character parts, without using a regex

I would stick with the regex, but since you asked and I've been looking for a good reason to use the unpack function...
use strict; use warnings; use Data::Dumper; my $size = 2; my $string='aabbccddee'; my $template = "a$size" x (length($string)/$size); if (length($string) % $size){ $template .= "a" . (length($string) % $size); } print "Unpack Template: $template \n\n"; my @parts = unpack($template, $string); print Dumper(\@parts);
Output:

Unpack Template: a2a2a2a2a2 $VAR1 = [ 'aa', 'bb', 'cc', 'dd', 'ee' ];

----
Coyote