Try slapping a DIM in your declaration there:

dim $errorpile[3]

-Shawn