This comment has nothing to do with your difficulties (except that we'll spot the source of one), just some notes on more idiomatic perl for your read loop.

First the preliminaries,

#!/usr/bin/perl use warnings; use strict; our (%sender, %receiver, @p_s};

You open a data file from a path given on the command line. There is an implicit mechanism in perl - the diamond operator with default argument - which does that, allowing you to skip opening the file. You were slurping the file, but that makes your loop run only once, with match only catching the first instance. Let's read it line by line with a while loop, and accept the default loop variable, $_, which allows us to use default match bindings and argument to chomp.

while (<>) { chomp;
You're not changing notation matching (\d)-(\d) and pasting the digits back together with "-", so let's keep them together and eliminate a couple of variables.
if (m/(\d-\d)->(\d-\d)/) { $sender{$1} = $2; $receiver{$2} = $1;
I'll change diagnostic prints to warns, so they go over STDERR.
warn "enter ", "$sender{$1}->$receiver{$2} ", "in dependency hashes\n"; }
More tricks follow with $1 and $2:     elsif (m/((\d)-\d)/) { I'm inclined towards push and shift in making a queue, but we'll stick with what you have,
unshift @{$p_s[$2]}, $1; warn "unshift $1 onto process array\n";
I'll skip the $numprocess variable entirely; you can get that from the arrays in scalar context.
} else { warn "unmatched line: $_\n"; } } # . . .
That's your code up through the read loop.

Using the empty diamond has two effects which may not suit you. First, every file listed on the command line will be read and parsed in order. Second, if none are listed there the diamond will look at STDIN, either a pipe or the terminal. Both are useful if you design for them, otherwise they can be a source of surprise.

After Compline,
Zaxo


In reply to Re: simple script question scope/structure for Perl noob by Zaxo
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.