in reply to Use of uninitialized value in open second time but not first.

This looks to me like perl weirdness. Setting $output to an empty string when it's declared seems to eliminate the warning.