use open IO => ':bytes'; $/ = \4096; ... while () { tr/\012\015\040-\176//cd; print $file $_; }