推荐用法:
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1;
print BOLD BLUE "This text is in bold blue.\n";
print "This text is normal.\n";
运行一下脚本,就可以查看常用的颜色属性
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1;
my @colors = qw(CLEAR RESET BOLD DARK UNDERLINE UNDERSCORE BLINK REVERSE CONCEALED BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE ON_BLACK ON_RED ON_GREEN ON_YELLOW ON_BLUE ON_MAGENTA ON_CYAN ON_WHITE);
for my $color (@colors)
{
print eval $color, "$color";
print CLEAR, "\n";
}