I turned the commet #'s into my's in your "declaration" block, added declarations for $line (before the input loop) and $i (in sub check_data) and changed the my $p_e = 0, $p_t = 0; line into two "my" lines. Running the result against a data file containing:

0-0->0-1 0-0->0-2

gave the following output:

begin Lamport's algorithm for input file delme.txt enter 0-1->0-0 in dependency hashes enter 0-2->0-0 in dependency hashes completed delme.txt parsing timestamp = 0 numevents = 0 contents of process stack: sender key/value pairs: 0-0 => 0-2 receiver key/value pairs: 0-1 => 0-0 0-2 => 0-0 schedule key/value pairs: contents of totalorder queue: timestamp: 0, numevents: 0 timestamp = 1 numevents = 0 contents of process stack: sender key/value pairs: 0-0 => 0-2 receiver key/value pairs: 0-1 => 0-0 0-2 => 0-0 schedule key/value pairs: contents of totalorder queue:

I don't know what it means, but the second loop sure is running.


Perl is Huffman encoded by design.

In reply to Re: simple script question scope/structure for Perl noob by GrandFather
in thread simple script question scope/structure for Perl noob by scotchfx

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.