In your code, there are two things you need to be aware of:
- The newline-char's are still there. If you do not want them, use chomp to remove them.
- You may have blank lines at the end of your files. If you do not want them, use grep to get rid of them.