use IPC::Run qw/run/; use IO::Tee; my $tee = IO::Tee->new(">output.log", \*STDOUT); # called output.log because it's both stderr and stdout my $printer = sub { print $tee @_ }; # kludge because IO::Tee doesn't implement the FILENO method my $in = ""; # this data is sent into the command run [qw/cleartool describe lbtype:MYLABEL/], \$in, $printer, $printer; #### run [qw/cleartool describe lbtype:MYLABEL/], \$in, $tee, $tee; #### run [qw/cleartool describe lbtype:MYLABEL/], ">&", $printer;