The equilibrium lattice constant, the cohesive energy and the electronic properties of light metal hydrides LiXH3 and XLiH3 (X = Be, B or C) with perovskite lattice structures have been investigated by using the pseudopotential plane-wave method. Large energy gap of LiBeH3 indicates that it is insulating, but other investigated hydrides are metallic. The pressure-induced metallization of LiBeH3 is found at about 120 GPa, which is attributed to the increase of Be-p electrons with pressure. The electronegativity of the p electrons of X atom is responsible for the metallicity of the investigated LiXH3 hydrides, but the electronegativity of the s electrons of X atom plays an important role in the metallicity of the investigated XLiH3 hydrides. In order to deeply understand the investigated hydrides, their optical properties have also been investigated. The optical absorption of either LiBeH3 or BeLiH3 has a strong peak at about 5 eV, showing that their optical responses are qualitatively similar. It is also found that the optical responses of other investigated hydrides are stronger than those of LiBeH3 and BeLiH3 in lower energy ranges, especially in the case of CLiH3.