Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^9: file open in perl tk

by vr786 (Sexton)
on Dec 07, 2010 at 05:17 UTC ( [id://875738]=note: print w/replies, xml ) Need Help??


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 (Archbishop) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://875738]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found