in reply to Re^8: file open in perl tk
in thread file open in perl tk

Hi monk, my test.txt file consists of following input lines

1 2 3 4 5 6 7 8 9 a b c d e f

The output of the file is

1 3 5 7 9 b d f

Replies are listed 'Best First'.
Re^10: file open in perl tk
by zentara (Cardinal) on Dec 08, 2010 at 15:31 UTC
    Hi, yeah, I see the problem too, but only with YOUR test.txt , which I downloaded.

    It looks like you have a test.txt file with MacIntosh line endings?

    With my test1.txt below, which has different octets than yours, things work better, but not perfect. There is still an odd behavior of the Tk Text widget inserting spaces. Its some sort of encoding problem, which eludes me. :-(

    test1.txt

    1 2 3 4 5 6 7 8 9 a b c d e f

    Running the program with your test.txt gives a Tk::Text output as

    1 /x(d) 3 /x(d) 5 /x(d) 7 /x(d) 9 /x(d) b /x(d) d /x(d) f /x(d)

    Running test1.txt, which has a unicode octet difference gives

    1 3 5 7 9 b d f

    Notice your sample text.txt shows /x(d) If I double quote "@contents", then I get a good result with my test1.txt , but an odd spce gets put in.

    1 2 3 4 5 6 7 8 9 a b c d e f
    So, it is some sort of encoding problem, which affects array interpolation. I am going to have to ask someone myself, in a new node.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh