http://www.perlmonks.org?node_id=677079


in reply to system() status weirdness

That's because Net::SSH::Expect is installing the following SIGCHLD handler:
sub reapChild { do {} while waitpid(-1,WNOHANG) > 0; }
Doing this will give you your statuses back:
use Net::SSH::Expect; ... $SIG{CHLD} = 'DEFAULT'; ... system(...);
I could be wrong, but I doubt the reapChild handler is absolutely necessary, so you're probably safe just use default handler even when you make Net::SSH::Expect calls.