Consider the following methods of array processing:

Assume that $List contains an unknown number of items, up to 100. We want to put them into an array that's exactly the right size, between 1 and 100 elements.

METHOD 1
 Code:
Dim $X[99], $P
$P = -1
For Each $E in $list
  $P=$P+1
  $X[$P]=$E
Next
ReDim Preserve $X[$P]

Only one ReDim, no UBound command, requires pointer for target array

METHOD2
 Code:
Dim $X[], $P
$P = -1
For Each $E in $list
  $P=$P+1
  ReDim Preserve $X[$P]
  $X[$P]=$E
Next

One ReDim commands per item, no UBound command, requires pointer for target array

METHOD 3
 Code:
Dim $X[]
For Each $E in $list
  ReDim Preserve $X[UBound($X)+1]
  $X[UBound($X)]=$E
Next

One ReDim and two UBound commands per item, no pointer needed. This code is very tight and self-managing, but requires more processing than either of the other two methods.

None is either right or wrong, but #1 might be better suited for systems with lots of memory or very large arrays. I say this because the larger the array becomes, the more times you will need to call ReDim and/or UBound functions, resulting in increased overhead.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D