in reply to connection to database interfering with $?
use POSIX(); system( @cmd ); my $child_exit_status = POSIX::WEXITSTATUS($?); [download]
use System::Command; my @cmd = qw( true ); my $cmd = System::Command->new( @cmd ); $cmd->exit(); # exit status [download]