The sub function basically receives the file as input, and then parses the data into an array, or list. The list is returned as output and is easier to go over.
This type of file parsing is called slurp
Also, if you want to get better at Perl, I highly recommend this book.
It really helped me out when I started learning Perl, and it will give you many valuable tools when you need to process biological data.
Good luck
Mr Guy
Comment on Re^5: reading and working with grow.out files