I am using this echo statement in perl ... i want my output in color... i think i cant make the output on screen in color with " printf" statement.. please tell me if it is possible for printf to give colored output..
This worked in a Linux Konsole and an xterm to set the color:
#!/usr/bin/perl
# @(#) p0 Demonstrate color in perl.
# use warnings;
# use strict;
$rgb_restore = "\e[00m";
$rgb_black = "\e[00;30m";
$rgb_red = "\e[01;31m";
$rgb_green = "\e[01;32m";
print "\nWith print:\n";
print " The word $rgb_red red $rgb_restore is red.\n";
print " The word $rgb_green green $rgb_restore is green.\n";
print "\nWith printf:\n";
printf(" The word $rgb_red red $rgb_restore is red.\n");
printf(" The word $rgb_green green $rgb_restore is green.\n");
print "\n";
print "$rgb_restore (Restoring)\n";
print "$rgb_black (Black)\n";
exit(0);
As you probably know, the color codes go up through "01;37m" for white ... cheers, drl