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

Re: [PATCH] Remove implicit split to @_

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
July 9, 2009 15:05
Subject:
Re: [PATCH] Remove implicit split to @_
Message ID:
4A56697E.2050805@pobox.com
Aristotle Pagaltzis wrote:
> * Michael G Schwern <schwern@pobox.com> [2009-07-09 23:05]:
>> Yitzchak said:
>>> I don't get why you'd want to do that. If I wanted to count
>>> space-separated fields, I'd do:
>>>
>>> $count = 1 + $thing =~ y/ //;
>> Yitzchak's altnerative approach is very clever but underscores
>> the need for making split in scalar context just DWIM.
>> Because... damn, that's how you're supposed to count fields?
> 
> That only works if the field separator is exactly one character,
> anyway. OTOH `1 + $str =~ m//g` works in the general case and is
> far less unintuitive.

Only perhaps in a relative sense.


-- 
Robrt:   People can't win
Schwern: No, but they can riot after the game.

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