sub run_command { # invoke system(@list) if more than one arg passed. ($#_) ? system(@_) : system($_[0]); if ($?) { my $rc = $? >> 8; die "Failed to run '$command': exit code $rc\n"; } } # Easy arg passing with a list; run_command('blah' , '-v' , '-q'); # Pass as scalar for shell interpretation of metachars run_command('tar cvf /dev/null /tmp/*.sock');