my $s = ' one "two three" four five "six seven eight" nine'; my @w = $s =~ / \s* #strip whitespace outside of paren "blocks" (?:"(?{local $openq=1}))? #note fact of open-quote without storing ((??{$openq ? '[^"]*' : '\w+'})) #store block (?:(??{$openq ? '"' : '\b'})) #gobble up closeq or word-boundary(really nop in this case) /gx; local $" = ':'; print "@w\n";