Should re-rewrite so you can pull all arguments on one line instead of many. i.e
my ($tsv,$flag,$tree_file,$output) = @_;
$output .= ">$output";

Info @ http://modernperlbooks.com/books/modern_perl_2014/05-perl-functions.html