I'm glad that you liked my post!

I actually used the Perl hash algorithm in a C project once. So I got pretty far into how Perl did it.

I wrote a .h file, memtracker.h for a local college. Students just included this .h file in their C or C++ program and magic happened. Without any source mods or link dependencies, this thing tracked C or C++ memory allocations and deallocations and when the user program exited, it showed whether there were any memory leaks and a table showing how all of this played out. It would say things like "on line X, that memory allocation has no corresponding deallocation", etc. Anyway I used a hash as the main data structure to keep track of things. Turned out to be a more complicated project that I had first thought - mainly due to making it work with 2 compilers each of C and C++ using the same single .h file. Final file was somewhat north of 1,500 lines of C with a lot of C pre-processor voo-doo. Anyway turned out to be a fun project. One C++ prof had his own version of this, but it was so slow, it was adding 20 minutes execution time to a large C++ lab! My version was so fast that it wasn't even user perceptible and it had more features. Using a very efficient data structure was a big part of the speed improvement.


In reply to Re^3: can I change hash keys or values directly by Marshall
in thread can I change hash keys or values directly by misterperl

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.