in reply to shift v. indexing into an array
I've read that monks avoid indexing into an array.
I think that's a mis-perception. Monks avoid iterating over array indexes simply to index it later on. So instead of
for (my $i = 0; $i < @array; $i++) { use $array[$i] here }
They write
for my $a (@array) { use $a directly here }
But there is absolutely no reason to avoid array indexing in general.
Should I be concerned about declaring my variables inside a while loop?
No.
|
|---|