Every other

Richard Huxton dev at archonet.com
Fri Oct 30 14:30:41 GMT 2009


Philip Potter wrote:
> 2009/10/30 Mark Fowler <mark at twoshortplanks.com>:
>> my $i;
>> my @new = grep { $i = !$i } @old;
> 
> Thinking about it further, this could be more readable as:
> 
> my @new = grep { ++$i % 2 } @old;

This one gets my vote for "the only one I'd want to come across without
a comment above it".

-- 
  Richard Huxton
  Archonet Ltd


More information about the london.pm mailing list