note
Not_a_Number
<blockquote>Any way to make it faster ?</blockquote>
<p>On my machine, this is slightly faster still:</p>
<c>'substr_loop2' => sub
{
my @arr;
my $s = $str;
push @arr, substr $s, 0, 8, '' while $s;
},</c>
<p>More seriously, though, not all the subs in your OP are equivalent: <c>'substr_map'</c> will truncate any string at a multiple of eight characters, while the others will include the extra characters in the final element of the array ([Fengor]'s <c>my @arr = $str =~ /(........)/g</c> has the same problem).</p>
586695
586695