in reply to Splitting inside an array

Here's a very simple approach, that does something like what you want: my @tokens = split /\s*([:=;()+]+)\s*/, $string; However, it really sounds like you want to be using a tokenizer/parser, that starts at the beginning of the string and matches one token at a time, rather than trying to handle the whole string at once. Have you considered Parse::RecDescent, for example?