sub exitstatus { ## # Exit Status Trap # Arguments required: &exitstatus(cmd); # # Examples: # my ($output, $status) = &exitstatus('/bin/cp', '/somepath/somefile', '/some/new/location'); # my ($output, $status) = &exitstatus($somecommand); # # Returns text output from the command as well as exit status. ## my $command = join ' ', @_ or die "No command specified\n"; if ($debug) { print "command: $command\n"; } ($_ = qx{$command 2>&1}, $? >> 8); }