I don't know Tk all that well but I assume that -textvariable expects to be given a reference to where it will eventually store the value from that widget. As written, it will store these in successvie elements of @{$info{EmpNum}}. I'm going to assume you have some valid reason for creating this array as a reference value in a hash with no other keys, rather than an ordinary array.

However, your foreach loop doesn't look right. What you are iterating over are the elements of the array,  @{$info{EmpNum}} yet you are treating each of these as if it is a key in %info that in turn returns an array of four elements. If true, then I have to assume this happens somewhere else, because your first block of code doesn't create anything like that. In any case you have a typo. $info{$_}>[0] should be $info{$_}->[0] or simply $info{$_}[0].

Update: I didn't fully read the thread above before posting. You can certainly do:

foreach (keys %info) { print "\t$info{$_}->[0]\t$info{$_}->[1]\t$info{$_}->[2]\t$info{$_} +->[3]\n"; }

Note the change from what you posted (%info instead of %info{EmpNum}). But again, given the code you posted, this will print only one row, because the only key in %info is 'EmpNum'


In reply to Re: Hash table issue by Errto
in thread Hash table issue by Anonymous Monk

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.