@parts = $string =~ m{ (?=\S) # so long as there's something ahead of us: [^\s"]* # non-quotes non-whitespace (?: " [^"]* " # a quoted part [^\s"]* # non-quotes non-whitespace )* # zero or more times }xg;