On Thu, Nov 11, 1999 at 01:00:25PM -0600, eric wrote: > This one works: > @cats = @cats[map (($_/2 + ($_ % 2) * ($#cats/2 + 1)), 0..$#cats)]; > > But this one is cleaner: > @cats = @cats[map (($_/2 + ($_ % 2) * ($#cats+1)/2 ), 0..$#cats)] I think I'd write the two changing parts as: (1+($#cats/2)) ((1+$#cats)/2) ... just to make the two lines the same length :) > Everyone see why? In the former case we're dividing by two (possibly giving a fractional answer) then adding 1, but in the latter case we're adding two integers (giving an integer) then dividing by 2 (possibly giving a fraction). So there's $#cats/2 less non-integer calculations. That's what I see. Tom -- -- Tom Rathborne tomr@aceldama.com -- http://www.aceldama.com/~tomr/ -- "I seem to be having tremendous difficulty with my life-style." ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe