local $_= q(one "two three" four five "six seven eight" nine); my @foo = grep {$_} /\G(?:(\w+)\s*)|(?:"([^"]*)"\s*)/g; local $,="\n"; print @foo, $/;