in reply to Perl, CGI, and streaming files
The moment I post this I solve the problem. Apache was configured to compress the response from the directory this was running in. Commenting out the SetOutputFilter DEFLATE in the apache config seems to have fixed this.