# Copy input to stdout or stderr.

my $out = $ARGV[0] ? \*STDERR : \*STDOUT;

while (<STDIN>) {
    print $out $_;
}