in reply to can you assign file handles?
open(OUT, $flag ? ">>output.txt" : ">>-") or die "..."; [download]