in reply to ascii colors from text file

Those are ANSI escape sequences. You need an ANSI terminal to see them.

...or an emulation. On Windows, adding use Win32::Console::ANSI; to your script will add ANSI support to your console.

Replies are listed 'Best First'.
Re^2: ascii colors from text file
by Anonymous Monk on Mar 02, 2007 at 17:45 UTC
    I know they are. My terminal has support. If i just drop the escape into a printer statement it works fine.

    I suspect that they escape is being lost as its read in from the text file and i remove the first slash.
      Sorry, I misread.

      In a double quoted string literal, \033 is replaced with character 33 oct (27 dec, 1B hex) in the resulting string. The following two statememts are equivalent.

      $str = "\033"; # ESC $str = chr(033); # ESC

      You'll have to do this conversion somehow.

      while (<DATA>) { s/\\\\033/\033/g; # \\033 -> ESC print; } __DATA__ \\033[0;30mcolor1 \\033[0;31mcolor2