use IO::Tee; $tee = IO::Tee->new($handle1, $handle2); print $tee "foo", "bar";