Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle colored output from command in perl?

I need to execute command from Perl script and print it's output, however command output is colored and Perl prints something like that:

ESC[33m sample text ESC[m 

instead of coloring sample text.

In other words: I want to know how to handle already colored input in Perl (not how to create colored output)

like image 684
korda Avatar asked Dec 14 '25 12:12

korda


2 Answers

I would start with the colorstrip function in Term::ANSIColor

like image 74
Jean Avatar answered Dec 17 '25 05:12

Jean


uncolor

uncolor takes input from files or standard input and returns in with colors and attributes stripped.

like image 30
toolic Avatar answered Dec 17 '25 06:12

toolic