my @split = $data =~ /\G(M|T|W|Th|F|Sa|Su|\d)/g; my @days = grep /\D/, @split; my @periods = grep /\d/, @split;