use Data::Dumper; $Data::Dumper::Terse = 1; print Dumper $_ for split /"([^"]*)"|\s+/, 'this "is" an "example"'; __END__ 'this' undef '' 'is' '' undef 'an' undef '' 'example'