while ($data =~ /PK\x01\x02/g) ... # find all file headers substr($data, $offset[1]+16, 1) ^= "\x01"; # change the crc