|Just another Perl shrine|
unerline or highlight keywords in a stringby rizzy (Sexton)
|on Jun 09, 2011 at 18:43 UTC||Need Help??|
rizzy has asked for the
wisdom of the Perl Monks concerning the following question:
I have some very long strings that I want to print to the screen and read through individually. In order to make it easier to read, I want to highlight (e.g., underline, bold, color, etc.) a few keywords.
Is there an easy way to do this without splitting up each string around every keyword and inserting formatting commands?
I think I can do a global replace of my keywords with the formatted keyword like so:
will this work, or will the print command interpret the formatting commands as plain text?
Also, is there a simple formatting command for bold or underline?