[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Interleaving arrays



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)]

Everyone see why?

- Eric


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe