Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!europa.asd.contel.com!sura.net!haven!uvaarpa!mmdf From: bjaspan@athena.mit.edu (Barr3y Jaspan) Newsgroups: comp.lang.perl Subject: Split question Message-ID: <1991Feb27.185226.7279@uvaarpa.Virginia.EDU> Date: 27 Feb 91 18:52:26 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: bjaspan@athena.mit.edu Organization: The Internet Lines: 22 I started off with the goal of splitting a string on whitespace without breaking quoted strings and ended up coming across the following split behavior that I do not understand. This script print "$]\n"; @_ = split(/ *(0[^0]+0) *| /, '0foo bar0 baz frob 0la la la0 quux'); print join(', ', @_),"\n"; produces the following output: $Header: perly.c,v 3.0.1.9 90/11/10 01:53:26 lwall Locked $ Patch level: 41 , 0foo bar0, baz, , frob, 0la la la0, quux (Think of 0 as a quotation mark and it will make more sense. I didn't want to deal with escaping ".) Why is there a null entry between baz and frob in the returned array? Thanks. Barr3y