sub 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";