Re: Can Perl redirect STDOUT to file AND to command window?
- From: xhoster@xxxxxxxxx
- Date: 29 Nov 2005 23:45:08 GMT
rcm228@xxxxxxxxx wrote:
> Thanks for the start, IO::Tee works well like this:
>
> use strict;
> use IO::Tee;
>
> my $tee = IO::Tee->new(\*STDOUT,">out.txt");
> print $tee "test\n";
>
> However, I am looking for something like this where I dont need to
> print to the $tee handle:
How about just selecting $tee so that it becomes the default output handle?
select $tee;
>
> use strict;
> use IO::Tee;
>
> my $tee = IO::Tee->new(\*STDOUT,">out.txt");
> open(STDOUT, ">&$tee");
Always check the success of your open.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- Follow-Ups:
- References:
- Prev by Date: Re: Can Perl redirect STDOUT to file AND to command window?
- Next by Date: Re: Can Perl redirect STDOUT to file AND to command window?
- Previous by thread: Re: Can Perl redirect STDOUT to file AND to command window?
- Next by thread: Re: Can Perl redirect STDOUT to file AND to command window?
- Index(es):
Relevant Pages
|