Chad Perrin schreef:

> [split works differently with ' ', /\s/, /\s+/]
> Why doesn't perldoc -f split say anything about that?  Never mind, I
> guess that's a rhetorical question.

It is all in the documentation:

<quote src="-f split">
  [...] By default, empty leading fields are preserved, and
  empty trailing ones are deleted.  (If all fields are empty,
  they are considered to be trailing.) [...]
  If EXPR is omitted, splits the $_ string.  If PATTERN is also
  omitted, splits on whitespace (after skipping any leading
  whitespace). [...]
  As a special case, specifying a PATTERN of space (' ') will
  split on white space just as "split" with no arguments does.
  [...] "split(/ /)" will give you as many null initial
  fields as there are leading spaces.  A "split" on "/\s+/" is
  like a "split(' ')" except that any leading whitespace produces
  a null first field.  A "split" with no arguments really does a
  "split(' ', $_)" internally. [...]
</quote>

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to