in reply to Term::ANSIColor - possible to pass color as variable?
Orsub print_debug { use Term::ANSIColor qw(:constants); my ($text, @colors) = @_; print STDERR @colors, $text, RESET; } use Term::ANSIColor qw(:constants); print_debug ("foo", BLUE ON_WHITE);
sub print_debug { my ($text, $color) = @_; use Term::ANSIColor; print STDERR colored([$color], $text), "\n"; } print_debug "bar", "yellow on_magenta";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Term::ANSIColor - possible to pass color as variable?
by ultranerds (Hermit) on Apr 13, 2011 at 13:34 UTC |