Peter Haworth wrote:
On Thu, 05 Dec 2002 15:17:57 -0500, Joseph F. Ryan wrote:
Again, C<< "STRING".split(' ') >> is different than
C<< "STRING".split(/\s+/) >>. The latter will add an empty element to
the beginning of the string if there is leading whitespace, which is
not the behaivor <<>> will have (if it acts like qw(), at any rate.)
I hate this special case. Why is there no way of specifying the removal of
leading empty elements with any other separator string?
Given that strings and regular expressions are different types of
objects, maybe the "single whitespace" rule could be extended to
any single character delimeter; e.g.:
@one = "|||x|h|i".split('|');
# @one = ('x','h','i');
@two = "|||x|h|i".split(/\|/);
# @two = (,'','','','x','h','i');
Joseph F. Ryan
[EMAIL PROTECTED]