Hypervirial-perturbational treatment of a particle in a box in the presence of an electric field