in reply to Why does the array not reset each time I call the function?
Hi,
First, a good practice would be to always turn on warnings (use warnings;), it may give you hints as to what could be the problem.
Then, the filehandle DATA is quite special in Perl, usually being used to read data stored in the program file. Try changing it to something else.
Lu.