Here is one idea
#!/usr/bin/perl -w use Tk; use Tk::Table; use strict; #I have an array {phone,mail,name} any idea how #can i put them in a table (in one row) ? #fill your list with AoA data somehow # you can also use a hash my @list = ( [12235673456, 'z@x.com' , 'ZZ Top'], [13456782345, 'b@j.net', 'The Boss'], [19873459789, 'me@where.com', 'You Know Hu'], [12235673454, 'y@x.com' , 'ZY Top'], [13456782346, 'bu@j.net', 'The Bus'], [19873459781, 'you@where.com', 'Yu Know Hu'] ); # get number of rows my $rows = scalar @list; print "$rows\n"; my $mw = MainWindow->new; $mw->geometry("475x125"); $mw->resizable(0,0); $mw->title("Table Example"); # best to put Table into a scrolled Pane my $table_frame = $mw->Frame() ->pack(-expand=>1, -fill=>'both'); my $table = $table_frame->Table(-columns => 3, -rows => $rows, -fixedrows => 1, -scrollbars => 'w', -relief => 'raised'); my $rowcount = 1; foreach my $col qw(Number Email Name){ my $tmp_label = $table->Label(-text => $col,-width=> 20, -relief =>' +raised'); $table->put(0, $rowcount, $tmp_label); $rowcount++; } $rowcount = 1; foreach my $row_ref (@list){ foreach my $col (1 .. 3){ my $tmp_label = $table->Label(-text => $row_ref->[$col -1], -padx => 2, -anchor => 'w', -background => 'white', -relief => "groove"); $table->put($rowcount, $col, $tmp_label); } $rowcount++; } $table->pack(-expand=>1, -fill=>'x'); my $button_frame = $mw->Frame( -borderwidth => 4 )->pack(); $button_frame->Button(-text => "Exit", -command => sub {exit})->pack() +; MainLoop;

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Table Problem by zentara
in thread Table Problem by Aboveyou

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.