in reply to Re: ascii colors from text file
in thread ascii colors from text file

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.

Replies are listed 'Best First'.
Re^3: ascii colors from text file
by ikegami (Patriarch) on Mar 02, 2007 at 17:53 UTC
    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