Thanks Bryce.

The only problem with your code is it did not allow the redim to have a variable so I add the line
$count=$count -1
and replaced the redim preserve $array[$count - 1] with
redim preserve $array[$count]