Re: Can Perl redirect STDOUT to file AND to command window?



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
.



Relevant Pages

  • Re: Most difficult water hazards in the UK
    ... And if you dont take that one on, ... I pretty much psyched myself out of the hole stood on the tee. ... Knowing how Sam plays I don't think the drive from the ... yellows would disturb him - the tee shot from the whites may even cause him ...
    (uk.sport.golf)
  • Re: advice please on kids using xp
    ... e.g keep them out of control panel and stop them from downloading ... (so i dont end up having to redo thier pc every second weekend) ... I'm not strict at all. ...
    (alt.os.windows-xp)
  • Re: What does the statement "exec >myfile.dat" mean?
    ... If your first ALL means only STDOUT -> yes. ... > Wouldn't it be better to use tee instead? ... Not if you dont want no output on your terminal;-) ... -- über den grenzen muß die freiheit wohl wolkenlos sein ...
    (comp.unix.shell)
  • Re: Abbreviate Currency using Javascript
    ... Well, I dont know, from where to start? ... evangelism: XHTML 1.0 Strict ...
    (comp.lang.javascript)
  • World Series
    ... As much as everyone wants to see the Halo's beat TEE, I dont want the ... Yanks to lose versus LA, ... But, only if the Dodgers ...
    (alt.sports.baseball.bos-redsox)