Typically file handles are as follows:
open (FILEHANDLE,file);
the file is usually in the format as follows:
'< filename' Open file for input
'+< filename' Open file for input and output append
'+> filename' Open file for input and output and truncate the data
'filename' Open file for input
'>filename' Open file for output, truncate data
'>>filename' Open file for output, append to file
You are using open (INTER, ">>fred");
This is strictly for writing, append to file. Because I do not see where you closed the file, I can not assume that you will not try to write to it later, so I would change it to: open (INTER, "+<fred");
Cameron