On Tue, July 29, 2008 10:38 am, Aristotle Pagaltzis wrote: > * Abigail <abigail@abigail.be> [2008-07-29 12:45]: > >> On Tue, Jul 29, 2008 at 11:05:27AM +0100, Nicholas Clark wrote: >> >>> By which you mean remove the assignment to @_, and the >>> warning, but keep the behaviour demonstrated above working? >> >> That would be quite useful, IMO, as the following secret >> operator doesn't work for split: >> >> $words +=()= split; >> >> >> It's one of the few places where perl incorrectly outsmarts the >> programmer. > > Do note that you can still beat perl at its own game: > > > $words += map 1, split; You beat me. I was going to say: $words++ for split; The "correct" answer would presumably be: $words += () = split ' ', $_, 0;Thread Previous | Thread Next