On 2013-03-07 10:21, WFB wrote:

waitpid($pid, 0);
close($trexe);
my $tr_ret = ($?>>8);

Never postpone the reading of a global variable,
just snapshot it as early as possible.

  my $child = waitpid $pid, 0;
  my $child_error = $?;  # snapshot a global

  $child == -1 and die "No child with pid $pid found";

  close $trexe or die "ERROR: $!";

  my $tr_ret = ($child _error >> 8);

--
Ruud


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to