Thank you for your ideas. I realize that I could keep the variable in an outer scope, but what I was trying to do was preallocate space without having it filled up with undefs, so I could use push on the array. My example code should have included a loop like the following inside the subroutine after the "Push stuff on the array here" comment: