On Jan 20, John W. Krahn said:

>Rob Dixon wrote:
>>
>> Sure. I'm saying that
>>
>>     split '\.';
>>
>> actually compiles as
>>
>>     split m'\.'
>>
>> and is therefore the same. It has to be a valid quotation character
>> though, because anything else won't be recognised out of context.
>
>So, you are saying that:
>
>    split ' ';
>
>Is the same as:
>
>    split m' ';
>
>And the same as:
>
>    split / /;

No, he isn't.  Except for the case of " " or ' ', the first argument to
split() is a REAL LIVE REGEX, no exceptions.  split('|') and split(/|/)
are the same thing.  split(" ") (from which split() with no args gets its
splitting string) splits like /\s+/, but it also ignores leading
whitespace.

  split(" ",   "  ab  cd  ef  ") -> "ab", "cd", "ef"
  split(/\s+/, "  ab  cd  ef  ") -> "", "", "ab", "cd", "ef"

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to