Hi folks,

Perl
===

Please advise how to add 'bold', 'italic', 'colour', etc. such features to the printout. Can HTML syntax work on perl? I tried seeming not applicable.

TIA

B.R.
satimis

What exactly are you printing?

If you're generating HTML, you can have Perl generate HTML tags. But, if you're just outputting to the console, there may be methods of using ASCII escape codes to display the desired text effects, similar to how you can do when working with the bash shell.

Hi alc6379,

Tks for your advice.

If you're generating HTML, you can have Perl generate HTML tags. But, if you're just outputting to the console, there may be methods of using ASCII escape codes to display the desired text effects, similar to how you can do when working with the bash shell.

Major problem already solved with "use Term::ANSIColor qw(:constants);"

!/usr/bin/perl -w
use strict;
use warnings;
use Term::ANSIColor qw(:constants);

print "\n";
print BOLD WHITE ON_MAGENTA "REMARK :", RESET "\n";
print RED "OLINENO=Old Line No. NLINENO=New Line No.", RESET "\n";
print RED "OWORDNO=Old Word No. NWORDNO=New Word No.", RESET "\n\n";
...
...
format   STDOUT_TOP=
       ORGINAL         MISTAKE      OLINENO    NLINENO    OWORDNO    NWORDNO
#       ORGINAL         MISTAKE      LINENO    WORDNO
.
format   STDOUT_MID=
       @<<<<<<<<<<     @<<<<<<<<<<  @##       @##       @##       @##
#       @<<<<<<<<<<     @<<<<<<<<<<  @##       @##
       $org,           $mis,        $lno1,    $lno2,    $wno1,    $wno2.

.

....

But I still could not resolve printing the heading inside "format" with colour. I tried many places adding the codes without success.

Please advise. TIA

B.R.
satimis

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.