Based upon the highly-problematic code you have posted here and other nodes you have written to date, I think you are trying run before you can walk. I would suggest getting a book to help you get on your feet - perhaps reading the free
Beginning Perl or getting the more current 6th edition of Learning Perl.
Break your process into its component steps:
- Import data from 3 files. While you are opening the input files (but you should probably read perlopentut), you never read the files. See I/O Operators in perlop.
- Average the data. You are not doing this. Perhaps sum from List::Util would be useful for you here.
- Output the result. Again, you open an output file, but never print a result.