Some people view this as cheating (shelling to another language), and I concede the point slightly, but offer the counter-point that dc is available on a *lot* of unix systems. A happy solution to this argument has been provided though...
Clifford Adams mailed me this RSA implementation in pure perl, using the perl bigint library.