You could also think of using a different algorithm, one which doesn't depend on perl's floating point numbers. Here I'm thinking of something like the
Unbounded Spigot Algorithms for the Digits of π...
Rabinowitz and Wagon call their algorithm a spigot algorithm, because it yields digits incrementally, and does not use digits after they have been computed. The digits drip out one by one, as if from a leaky tap. In contrast, most algorithms for computing the digits of π deliver no output until the whole computation is completed.
Update: fixed broken link.
-- All code is 100% tested and functional unless otherwise noted.