The OP's example made it clear that no values from @a were to be skipped. $i should not increment each time, and even if it should, it should either be set to -1 before the 'loop', or incremented after the ternary. Your sample preincrements $i so $a[0] would always be skipped.
In reply to Re^3: add elements to array at certain positions
by GrandFather
in thread add elements to array at certain positions
by coldy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |