in reply to Accessing array elements
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) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing array elements
by JavaFan (Canon) on Jun 18, 2009 at 15:02 UTC | |
|
Re^2: Accessing array elements
by AnomalousMonk (Archbishop) on Jun 18, 2009 at 16:40 UTC |