Vicki Brown wrote: > > At 11:32 -0600 98/06/16, Sean M. Burke wrote: > > MacPerl coda, as it wasn't relevant), in the past month I've learned not > > one, but TWO scary and obscure things about the functionality of > > split(). > > I don't care if they aren't Mac-specific (but you already knew that :-)... > > Don't leave us hanging! What are they??!! What I learned, I could have found out in these bits of the perlfunc docs: Perldoc wrote: >[...]If LIMIT is unspecified, trailing null fields are stripped >[...]If LIMIT is negative, it is treated as if an arbitrarily large >LIMIT had been specified. But, not knowing any of this, what sent me to #perl was that split(":", ":foo:::") was giving me ('', 'foo'), which I considered Wrong. It turns out what I needed was split(":", ":foo:::", -1). (Whether the language is Wrong for having this "trailing null fields are stripped" proviso is a matter of aesthetics.) And I was demonstrating what I thought was wrong by saying what print scalar(split(":", ":foo:::")) was printing, which set someone off saying that split in a scalar context is deprecated, which sent me to the docs to discover: >If not in a list context, returns the number of fields found and ^^^ this I expected as normal coercion >splits into the @_ array. ^^^ this was news to me. >(In a list context, you can force the split >into @_ by using ?? as the pattern delimiters, but it still returns >the array value.) The use of implicit split to @_ is deprecated, >however. Cruft cruft cruft. ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch