in reply to Capturing shell command error

If your original "du" command is covering a lot of sibling directories that match "/tmp/dir*", and if each of those has a any amount of subdirectory structure, then I would probably stick with your backtick approach, but it can be very simple:
my @size = `du -sk /tmp/dir* | cut -f1`;
Note that in a list context (e.g. assigning to an array), the backticks will split on line breaks for you, and retain the line-feed at the end of each line (each element of the array).

If the "du" fails there, @size will be empty, but the error report from du will go to your STDERR. If you want to catch the error report, and you are using a bourne-style shell (as opposed to a csh-style shell), you can redirect the shell's stderr, as explained at length in the description of "qx" (backtick opertator) in "perldoc perlop":

my @size = `du -sk /tmp/dir* 2>&1 | cut -f1`;
This will put the error message as the sole element of @size. Then again, if you somehow get warnings on some files/paths, like "permission denied", these will be mixed in with size numbers for paths that had no problems -- which makes @size kind of a mess... So you could redirect the shell's stderr to a file (if you want to read it later from the perl script) or just redirect to /dev/null (if you don't need to read it).