sub _print { print $msg, @_; print LOG $msg, @_; } _print("hello"); _print("world"); #### use IO::Tee (); my $fh_out = IO::Tee->new(\*STDOUT, \*LOG); select($fh_out); print("hello"); print("world");