in reply to Comparing sorted arrays

As others have said, the test you're doing now only tells you whether the two arrays are the same length. While not sufficient, it is certainly a good test to do, since if the two arrays are different lengths, they can't possibly be "equal". So in your array-comparing subroutine, that's the first thing you should do.
# pass it two arrays, by reference. sub arrays_equal { my( $ar1, $ar2 ) = @_; @$ar1 eq @$ar2 or return 0; # different lengths. # now do member-wise comparison: for my $i ( 0 .. $#{$ar1} ) { $ar1->[$i] eq $ar2->[$i] or return 0; # short circuit } return 1; # all members compared equal. } # call it like so: if ( ! arrays_equal( \@savedpids, \@livepids ) )
Note that I used string equality. If the arrays are going to contain only numbers, then you'd want to use numeric comparison (==) instead.

As an added syntactic nicety, you can write this subroutine with a prototype, so you don't have to pass the arrays explicitly as references:
sub arrays_equal(\@\@) { # everything else is the same } # then you can call it like so: if ( ! arrays_equal( @savedpids, @livepids ) )
If you use the prototype, however, the declaration of the sub must come before the point of first use.

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.