in reply to Re: Pass on name of array
in thread Pass on name of array
'#' when applied to arrays returns the last valid index, so a less than conditional will fail on the last valid index, meaning that index will never be used. Alternately, you could use the size of the array:for ($br = 0; $br <= $#{$array}; $br++)
or, to eliminate any ambiguity,for ($br = 0; $br <= @$array; $br++)
for ($br = 0; $br <= scalar(@$array); $br++)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Pass on name of array
by merlyn (Sage) on Apr 05, 2001 at 21:52 UTC | |
by tilly (Archbishop) on Apr 06, 2001 at 12:29 UTC |