Running your script results in
code:
-1-
0
1
-2-
0
1

I don't see anythign wrong with it. However, you never set $x to any value. alos if you want to just get all text files into an array then you can dynamically resize the array with REDIM PRESERVE and you don't have to enumerate the files twice.
_________________________
There are two types of vessels, submarines and targets.