$/ = \65535; # You can try different numbers here. print {$NEW} $header; print {$NEW} $_ while <$OLD>;