Home » Faqs » System » Print color |
This will only work if the terminal you're using supports color. And be warned that the user may have changed their background color.
Use a module called Term::ANSIColor. This module makes it very simple to color your terminal output:
#!/usr/bin/perl use strict; use warnings; use Term::ANSIColor; print color("red"), "Red!\n", color("reset"); print color("blue"), "Blue!\n", color("reset"); exit 0;
perldoc -q 'color' perldoc Term::ANSIColor