You are using $FILE in your
system() call, which you don't define, but you do have an
open FILE, "<", "output.txt" right above it, so I think that you think that using
$FILE at the end of the system command will use output.txt as the input, which is incorrect. The correct code would be
system "mailx -s \"Testing Report\" name@company.com < output.txt";
You could also open a pipe with
open MAILX, "| mailx -s \"Testing Report\" name@company.com";
and write to MAILX to bypass creating the file altogether.