If you look at code written by Perl experts then you'll probably notice that they very rarely use the C-style for loop like you're using here. Most people find the shell-style foreach loop far easier to deal with.
In this case, I think you want:
foreach my $i (0 .. ($#array/2) - 1) { ... }
In reply to Re: Accessing array elements
by davorg
in thread Accessing array elements
by Ravendark
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |