while (length $input > 6){ my $front = substr($input, 0, 6, ''); push @sets_of_six, $front; }