while (my ($i, $element) = each @array) { do_something( $element ) unless $i % 3; }