Yes, C executes faster than Perl.

But it is often easier to write better programs in Perl than C.

Hand the following problem to your co-worker as a problem. Anagrams are words which are the same except for the order of the letters. Write a program which takes a list of words (separated by newlines) on STDIN, and then prints out all of the different anagrams. (Tell him to make it case insensitive if he can, if he can't then don't worry too much about that detail.) Ask your friend to do it in C.

When your friend is done, have your friend compare his performance with the simple script that I threw together in 5 minutes and posted to Find anagrams. Take a reasonable sized /etc/dictionary and throw it at both programs.

For more advocacy about using Perl instead of C see Re (tilly) 1: Why Use Perl?. It is about web programming in particular, but many of the points apply to other environments.


In reply to Re (tilly) 1: Perl speed VS. other languages by tilly
in thread Perl speed VS. other languages by tretin

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.