Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^7: file open in perl tk

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


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

Hi monk, I found a problem using above code , whenever I try to open a file "./test.txt" it will show the alternative lines only, if my test.txt file containing the data 10 lines it will show only five lines , why it is behaving can you help , how can i over come this problem?

Replies are listed 'Best First'.
Re^8: file open in perl tk
by zentara (Archbishop) on Dec 02, 2010 at 14:40 UTC
    whenever I try to open a file "./test.txt" it will show the alternative lines only,

    ...that my friend is truly bizarre behavior.... show us the code


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

      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
        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://874825]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found