Try this 


> I wondered if anyone could steer me to some information about making
> perl script output appear in color highlight on stdout.
> 
> Something like what modern grep does on linux, where the searched term
> appears in some color (red) in the output to tty.
> 
> 

Try this code snippet:

    my $e = "\033[0m";
    my %cc = (
        white => "\033[1;37m",
        ltgray => "\033[0;37m",
        gray => "\033[1;30m",
        black => "\033[0;30m",
        red => "\033[0;31m",
        ltred => "\033[1;31m",
        green => "\033[0;32m",
        ltgreen => "\033[1;32m",
        brown => "\033[0;33m",
        yellow => "\033[1;33m",
        blue => "\033[0;34m",
        ltblue => "\033[1;34m",
        purple => "\033[0;35m",
        pink => "\033[1;35m",
        cyan => "\033[0;36m",
        ltcyan => "\033[1;36m",
    );

    print $cc{red}, "This is red text.\n", $e;

- B



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to