in reply to Pi golf:

Taking advantage of jimt's observation, 36 chars:

$s+=6/$_**2for 1..10**6;print sqrt$s


--chargrill
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}

Replies are listed 'Best First'.
Re^2: Pi golf:
by liverpole (Monsignor) on Sep 05, 2006 at 22:00 UTC
    ++chargrill; very spiffy.

    You realize of course ... changing print to die saves 2 more, and sqrt(X) is the same as X^0.5, but the latter lets you squeeze out an extra space ...

    33 chars:

    $s+=6/$_**2for 1..10**6;die$s**.5

    ... and now that I see Tanktalus' nice suggestion above, and also realizing that map saves another space over for ...

    31 chars:

    map$s+=6/$_**2,1..1e6;die$s**.5

    Update:  Come to think of it, the number 31 is nicely appropriate, given the topic (ie. 31 = int(10 * pi))


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      Actually, map doesn't save any space (nor does it cost any):
      $s+=6/$_**2for 1..1e6;die$s**.5 map$s+=6/$_**2,1..1e6;die$s**.5
        You're right... good observation.

        I still think it looks better, though, because it lets you omit the space after the for, even though that gets replaced with the ','.


        s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/