foreach $line () { chomp $line; if ($line =~ m/(\d)-(\d)->(\d)-(\d)/) { #create local sender and receiver vars my $sp = "$1-$2"; my $rp = "$3-$4"; #update sender and receiver hashes $sender{$sp} = $rp; $receiver{$rp} = $sp; print "enter $sender{$sp}->$receiver{$rp} in dependency hashes\n"; } elsif($line =~ m/(\d)-(\d)/) { #create local process var my $p = "$1-$2"; #queue process on @p_s multi-dimensional array unshift (@{$p_s[$1]},$p); print "unshift $p_s[$1][0] onto process array\n"; $numevents++; } else { print "\nunmatched line: $line \n"; chomp($line); #remove empty newlines in input file } }