Escape Characters

Mark Fowler mark at twoshortplanks.com
Thu Jan 16 17:15:44 GMT 2003


On Thu, 16 Jan 2003, Abdul Salam K wrote:

> How can I create Bold and Highlighted characters on the screen. I know it is
> created by some special characters like ^[. But, how can I get the keyboard
> sequence for these characters?.

I happened to have this open on my desktop while I was reading your email:

  http://www.fh-jena.de/~gmueller/Kurs_halle/esc_vt100.html

>From perl, you can create sequences like:

  perl -e 'print "\x1B[1m"'

Of course, if you're going to use Perl then you might as well use the
Term::ANSIColor module that ships with Perl.

        use Term::ANSIColor;
        print color 'bold blue';
        print "This text is bold blue.\n";
        print color 'reset';
        print "This text is normal.\n";
        print colored ("Yellow on magenta.\n", 'yellow on_magenta');
        print "This text is normal.\n";
        print colored ['yellow on_magenta'], "Yellow on magenta.\n";

The online documentation for that module is here:

  http://search.cpan.org/author/RRA/ANSIColor/ANSIColor.pm

One of the lightening talks at the upcoming London Perl Mongers Technical
meeting on Thursday Jan 23rd (week today) will deal with tricks you can
play with VT100 terminals and perl signatures...see
http://london.pm.org/pipermail/london.pm-announce/2003-January/000037.html
for more info.

Right, see you all in the pub.

Mark.

-- 
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, mark at twoshortplanks.com, http://twoshortplanks.com/};




More information about the Ukfreebsd mailing list