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); } #### Running: 'hostname' on admin001: admin001 Running: 'uptime' on admin001: 09:42:50 up 333 days, 22:24, 4 users, load average: 0.05, 0.10, 0.36 Running: 'date -I' on admin001: 2014-05-29 Running: 'hostname' on mon001: mon001 Running: 'uptime' on mon001: 09:42:51 up 333 days, 22:23, 1 user, load average: 1.18, 0.74, 0.57 Running: 'date -I' on on001: 2014-05-29 #### Useless use of right bitshift (>>) in void context at - line 437.