http://www.perlmonks.org?node_id=159407


in reply to Golf -- compute PI

Here's a few more methods of achieving pi:

# 39 Characters
map$x+=(-1)**$_*4/(2*$_+1),0..1e6;die$x

Now, I know Ovid said no Trig functions, but I couldn't resist. Perhaps we could consider the next two examples mulligans :-)

# 45 Characters
use Math::Trig;die 16*atan(1/5)-4*atan(1/239)

# 21 Characters
use Math::Trig;die pi

-Eric

Update: Taking some of PrakashK's suggestions, shaved off a few more characters. Thanks PrakashK! :-)