in reply to Re: color STERR red?
in thread color STERR red?

That works unless STDOUT uses the same stream as STDERR, in which case all printed code after the STDERR prints are also red.

You should use

print STDERR color ("red"), @_, color ("reset");

or use the colored ("red", string) approach.

If you need more than just colors, like indents or modification, you can use Text::OutputFilter as an alternative:

use strict; use warnings; use Text::OutputFilter; use Term::ANSIColor; tie *STDERR, "Text::OutputFilter", 0, *STDERR, sub { color ("red")."$_[0]".color ("reset") }; print STDOUT "Normal\n"; print STDERR "Red?\n"; print STDOUT "Normal again?\n";

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: color STERR red?
by rastoboy (Monk) on May 10, 2011 at 02:19 UTC
    Thank you all, lots of great suggestions! /me ponders...