that is what is so nice about Perl - it translates nearly exactly over to C when you are writing it

Perhaps that's part of your problem. I don't mean that in a nasty way - I know when I started writing Perl my code looked a lot like C too. The secret to writing Perl that runs fast is to use Perl's built-in functions to do the work for you, since they are written in optimised C (albeit optimised for a general case). The more lines of Perl code that you write, the more time Perl will need to spend branching and switching between ops. Whereas if you can pare your code down so that the work gets done by map, foreach, tr, regexes etc then the execution time should drop.

It really raises a red flag for me that your Perl implementation ended up longer than the equivalent thing written in C. These days when I have to write C I get frustrated at how many lines of code I have to execute to do anything useful.


In reply to Re: Re: Re: Confirming what we already knew by grantm
in thread Confirming what we already knew by AssFace

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.