develooper Front page | perl.perl5.porters | Postings from July 2009

Re: [PATCH] Remove implicit split to @_

Thread Previous | Thread Next
From:
Peter Scott
Date:
July 10, 2009 10:03
Subject:
Re: [PATCH] Remove implicit split to @_
Message ID:
6.2.3.4.2.20090710095942.04003900@mail.webquarry.com
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=0137001274



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About