in reply to Redirecting output

I noticed that you close and reopen STDERR, but don't close STDOUT before you open it. That could possibly be the problem. Try:
close STDERR; close STDOUT; open STDERR, '>', "$outpath/arbol.log"; open STDOUT, ">&STDERR";