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.
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |