Timothy Johnson wrote:
The confusion comes from the poor wording of the perldoc.
"As a special case, specifying a PATTERN of space (' ') will
split on white space just as "split" with no arguments does.
Thus, "split(' ')" can be used to emulate awk's default
behavior, whereas "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."
It doesn't make it clear whether it's really talking about whitespace
(as in \w) or just spaces.
This is why I avoid using "magic" whenever possible.
Looks like I picked the wrong day to stop sniffing glue.
I meant \s, of course. In this case the problem is not with the wording
of the doc, but with the confusing array of options. My same conclusion
applies.
*sheesh*
just to let everyone know, (I thought I had done this already but with
the list reply stuff I messed that up)
The problem is fixed, my split was correct, but my test to see if my
split was correct was wrong
I was printing the array in debug mode, but not in a way that would
indicate that the values where in separate elements.
I was also printing the "count" of array elements and that apparently is
also wrong, I was getting 1 when I should have got >1.
The doc I read said that there is a special variable called #$arrayname
that has the count of array elements.
But this isn't correct, so how do you return the count of array elements?
--
Rance Hall
System Administrator
Nebraska Turkey Growers
1-308-468-5711, ext. 106
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>