Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
This code looks suspiciously like the examples for Huffman Encoding in "Mastering Algorithms with Perl". I'm not sure what you think it should do, but the ',' in there is not valid syntax and should be replaced with a '?'. You've also got a $cur_code where you want a $cur_node. For your typo convenience, all of the examples in the book are available in .tar.gz or .zip format from O'Reilly's web site.

We really need to see what you constructed for the get_bit() and put_stream() routines and how you constructed your hash tree.

If you still don't understand how this works after you get the typos fixed, I'm sure we can discuss how this walks down a tree looking for nodes, checking whether a node contains a value or a link/reference to another node, and outputting any values found or following the link/reference to the next node depending on what it finds in the current node. :)


In reply to (ichi) Re: Converting Stream of bits back into Stream of Characters it Encodes by ichimunki
in thread Converting Stream of bits back into Stream of Characters it Encodes by AllyClark

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (11)
    As of 2014-04-21 14:59 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (495 votes), past polls