in reply to What is wrong with this code?

In addition to toolic's and jethro's catches, note that the syntax of your formula for the area of a square isn't correct. It will give the area as (side times 2); you want $square_side**2 ($square_side to the power of 2, eg, squared).

Also, check your spelling (parallelogram and equilateral, for example), lest you teach li'l bro' errors and review your geometry text to check your title in the triangle formula.

Other suggestions, depending on your taste:

Updated: to acknowledge jethro's excellent point, posted as I fiddled with minutia and eyepopslikeamosquito's catch on my brain-fart.

Replies are listed 'Best First'.
Re^2: What is wrong with this code?
by jdporter (Paladin) on Jul 24, 2011 at 02:22 UTC
    you'll have less overhead (and more portability) if you simply define pi as 3.14159

    Blech. Get maximum precision without Math::Trig (and without programmer error):

    $PI = 4 * atan2(1,1);
    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
Re^2: What is wrong with this code?
by eyepopslikeamosquito (Archbishop) on Jul 24, 2011 at 02:05 UTC

    you'll have less overhead (and more portability) if you simply define pi as 3.141659 rather than using Math::Trig.
    Of course, that should read 3.14159. Or even 3.14159265358979323846264338327950288419716939937510 :)