This paper shows the usefulness of Perov's contraction principle, which generalizes Banach's contraction principle to a vector-valued metric, for studying dynamic programming problems in which the discount factor can be stochastic. The discounting condition $\beta<
1$ is replaced by $\rho(B)<
1$, where $B$ is an appropriate nonnegative matrix and $\rho$ denotes the spectral radius. Blackwell's sufficient condition is also generalized in this setting. Applications to asset pricing and optimal savings are discussed.