my @s = qw/ hallohallohallO hannahannahannA /; for (@s) { $_ = [m/(.{1,5})/g]; } for my $i (0 .. $#{ $s[0] }) { for (@s) { print "$_->[$i]\n"; } }