in reply to to calculate the value of π
Is it really homework? Then you better NOT submit this:
use strict; use warnings; use bignum accuracy => 30; use feature 'say'; $/=--$,;say+4*($\+=($/*=-1)/($,+=2))for+1..10; [download]