http://qs1969.pair.com?node_id=109988


in reply to Trig in Perl

There are many style issues (indentation, variable naming schemes) that I would change, but the thing that would probably help you most would be to use Perl's built-in trigonometry operators: cos, sin, atan2, etc. Also, you might want to get rid of sub_haiku(), opting for Carp or warn and die. Also use constant PI => 3.14159 would be a more proper way to define pi that $pi = 3.141.

Beyond that, I don't know what to tell you. Through experience (as long as you care about doing things elegantly and efficiently), you will learn how to shorten code and make it look (and be) cleaner and sexier.

redmist
Purple Monkey Dishwasher

Replies are listed 'Best First'.
Re: (redmist) Re: Trig in Perl
by Hofmator (Curate) on Sep 04, 2001 at 12:58 UTC

    Also, you might want to get rid of sub_haiku(), opting for Carp or warn and die.
    Or use Damian Conways's Coy to die with style and haiku ;-)

    -- Hofmator

      <html><body>

      Thanks for that, I'll try them out as I had not heard of them before :)

      Dr Lambado

      </body></html>