I was under the impression that 'while(@files)' iterates over each item of the array as long as @files is true, which means as long as it reaches up to the last item of tha array @files.
ps. I have a book and read a few things last year but i guess that i need to read more...