At 08:55 AM 7/10/2009, Chas. Owens wrote: >On Fri, Jul 10, 2009 at 10:39, Peter Scott<Peter@psdt.com> wrote: > > > I don't get it. The docs say that scalar split returns the number of > > elements. That's useful and convenient, and more intuitive than some of > > the alternative gyrations that have been suggested. No one cares about it > > shoving the contents in @_ or wants that to continue, especially since it > > results in a warning. So why can't we make it return the number of > > elements without either populating @_ or generating a warning? > >The question is when do you want to know how many items a string can >be split into without actually splitting the line? If you are going >to split the line, then you can ask the array how many elements it >has. It's come up often enough for me that I posted about this very topic a year ago: http://groups.google.com/group/perl.perl5.porters/msg/d46cc73f331d697c?hl=en&dmode=source wherein you'll find one good example of its use. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ http://www.perlmedic.com/ http://www.informit.com/store/product.aspx?isbn=0137001274Thread Previous | Thread Next