multiprint("hello\n", LOGFILE, TEMP); sub multiprint { my $text = shift; for my $fh (@_) { print $fh $text; } }