Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

How to Print Underline Text in PERL.

by ungalnanban (Pilgrim)
on Apr 23, 2010 at 06:42 UTC ( [id://836428]=perlquestion: print w/replies, xml ) Need Help??

ungalnanban has asked for the wisdom of the Perl Monks concerning the following question:


I want to print my output in STDOUT with underline some important words. like the following example

WELCOME TO PERLMONKS

I used the following way:
system("echo -e \"\033[36;38m WELCOME \033[37m\" ");

Is there any better way to do this?
--$ugum@r--

Replies are listed 'Best First'.
Re: How to Print Underline Text in PERL.
by almut (Canon) on Apr 23, 2010 at 07:12 UTC

    You could use print instead of system and echo:

    print "\e[36;38mWELCOME\e[37m TO PERLMONKS\n";

    And - if you need it more than once - you might want to put the respective ANSI escape sequences in variables, so it's easier to type and read:

    my $UL = "\e[36;38m"; my $UE = "\e[37m"; print "${UL}WELCOME$UE TO PERLMONKS\n";
Re: How to Print Underline Text in PERL.
by Anonymous Monk on Apr 23, 2010 at 07:13 UTC
Re: How to Print Underline Text in PERL.
by ungalnanban (Pilgrim) on Apr 23, 2010 at 07:11 UTC
    I got the following way
    use Term::ANSIColor; print color 'bold'; print "This is bold"; print color 'underline'; print "This is bold"; print color 'reset'; print "This is bold";

    In Term::ANSIColor module "blink" is not working for me, how to make it blink. ?
    print color 'blink'; print "This is blink\n\n";
    Thank you..
    --$ugum@r--
        I think it's because it wasn't underlined, or in bold, or somesuch. ;-)

        p.s. The reason why this matters is because some people, like myself, use CSS to show sigs much lighter than the normal node text, because I find sigs distracting. So if you put your whole text in your "sig", it'll all show up lighter — almost unreadable, and very distracting, to read.

        Personally I find the fact that the sig in the same textarea as the node when editing, a design mistake on this site.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://836428]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-19 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found