in reply to trapping system error
my $result = qx/ $command 2>&1 / [download]
But in this case it's probably much easier to use the mkpath function from File::Path (it's a core module).