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

In reply to Re^10: file open in perl tk by zentara
in thread file open in perl tk by vr786

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.