@parts = split m{ " # if we match a quote (?{ ++$x }) # increment quote counter (?!) # and fail | \s+ # or if we match whitespace (?(?{$x&1}) # if $x is odd (?!) # fail ) # (otherwise succeed) }x, q{A B "C D" E F"G H" I};