We develop a novel linear-scaling [O(N)] algorithm for calculating the optical dielectric constant and Born effective charge. Our method relies on the fact that only the sum of the nondiagonal parts of the electric field perturbation in solids contributes to the first-order derivative density matrix, which can then be obtained through the density-matrix perturbation method. The optical dielectric constant of amorphous SiO(2) is computed using a realistic model for the first time.