How do I color output text from Perl script on Windows?

后端 未结 5 956
别那么骄傲
别那么骄傲 2021-02-06 00:36

I would like to color format the text printed to the console using the Perl print command.

In my case the script will only be run under WinXP-DOS Command Line but it wou

5条回答
  •  花落未央
    2021-02-06 01:03

    For any terminal that supports ANSI escape codes you can use the Term::ANSIColor package available on CPAN.

    From the Wikipedia page:

    Console windows in Windows versions based on NT (Windows NT 4.0, Windows 2000, Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008) do not natively support ANSI Escape sequences, though some support is possible.

    Don't know any more Windows-specific information than that, I'm a POSIX guy. :-)

提交回复
热议问题