tags:

views:

104

answers:

3

How do I color text in Perl's standard output without using any extra module?

+4  A: 

Using BASH? Check here: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

eumiro
using Perl..........
Tree
If you don't want to use any extra perl module, then you have to print those special characters in the perl's stdout. A color of the character is interpreted by bash, so if you use bash, you have to use its color encoding described in that document.
eumiro
Terminal control sequences are interpreted by your terminal program or console driver, not by bash.
Peter S. Housel
+6  A: 

We can use Term::ANSIColor.

Tree
Or just [copy its source code](http://cpansearch.perl.org/src/RRA/ANSIColor-3.00/ANSIColor.pm)
mobrule
Although copying its source code it topologically the same as installing it. :)
brian d foy
+5  A: 

Have a look at http://en.wikipedia.org/wiki/ANSI_escape_code to know which control sequences to output if you do not want to use any module.

jeje