while ($word) { ($consonants, $vowel, $word) = split(/([aeiou])/, $word, 2); # do something here }