#!/usr/bin/perl # # Dummy of outer perl script # This time calling the binary without shell wrapper script # use strict; use warnings; # # Export the environment variable for the child binary # directly from Perl # $ENV{MY_VAR} = "something else"; my $binary = "./simulated_binary_executable.pl"; system($binary); # Run the external program if ($? == -1) { print "Child '$binary' failed to execute: $!\n"; } elsif ($? & 127) { printf "Child '%s' died with signal %d, %s coredump\n", $binary, ($? & 127), ($? & 128) ? 'with' : 'without'; } elsif ($? == 0) { print "Child '%s' exited successfully.\n"; } else { printf "Child '%s' exited with value %d\n", $binary, $? >> 8; }