G'day coder_perl,

"This doesnt seem to work !"

That tells us nothing useful at all. What didn't work? In what way didn't it work? What output did you get? What output were you expecting to get? Were there any error or warning messages? Please following the guidelines in "How do I post a question effectively?" when posting questions.

Why are you using sysopen to read a text file? Why are you using a mode of O_RDWR?

Possible options (for better ways to access the data) might include not using an intermediary file, but instead iterating the output of your egrep command by using:

Your "$myLabel=..." is also problematic. You assign each Tk::Label widget you create (in every iteration of the while loop) to the same package global variable. The 'vars' stricture of strict would have warned you about this.

The title of your post also needs mentioning: "Perl tk" is far from adequate. A better choice would be something like: Problem creating Tk::Label widgets from file data. See "How do I compose an effective node title?".

-- Ken


In reply to Problem creating Tk::Label widgets from file data (was: Re: Perl tk) by kcott
in thread Problem creating Tk::Label widgets from file data by coder_perl

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.