i know this is not a new question..but i try follow the solution working out from other post...but there are nothing to print out on my text area...if i directly print a sentence on my text file..it's work..why?
#!/usr/local/bin/perl use Tk; use File::Tail; #Main Window my $mw = new MainWindow; $mw-> title ("Packet Analyzer Tool"); my $frm_1 = $mw -> Frame() -> pack(); my $frm_2 = $mw -> Frame() -> pack(); my $frm_3 = $mw -> Frame() -> pack(); my $frm_4 = $frm_3 -> Frame(-relief => 'groove', -borderwidth =>2) -> +pack(-side => "left"); my $frm_5 = $frm_3 -> Frame() -> pack(-side => "right",-after => $frm_ +4); my $but1 = $frm_1 -> Button(-text => "Start", -command =>\&push_start) -> pack(-side => "left", -anchor => 'nw', -ipadx => 30, -ipady + => 35); my $but2 = $frm_1 -> Button(-text => "Stop", -command =>\&push_stop) -> pack(-side => "left",-after =>$but1, -expand => 1,-ipadx => + 30, -ipady => 35); my $but3 = $frm_1 -> Button(-text => "Pause", -command =>\&push_pause) -> pack(-side => "left",-after => $but2 ,-ipadx => 30, -ipady +=> 35); #21 my $but4 = $frm_1 -> Button(-text => "Exit", -command =>\&push_exit) -> pack(-side => "left", -after => $but3 ,-ipadx => 30, -ipady + => 35); my $filter = $frm_2 ->Entry(-width => 65) -> pack(-side =>"left",-anch +or => 's'); my $but5 = $frm_2 -> Button(-text => "Search", -command =>\&push_searc +h) ->pack(-side => "left", -after => $filter, -ipadx => 10); my $txt1 = $frm_4 -> Text(-width => 60, -height =>20) -> pack(-side =>"left",-anchor => 's'); my $srl = $frm_4 -> Scrollbar(-orient=>'v', -command =>[yview => $txt] +); $txt1 -> configure(-yscrollcommand =>['set',$srl]); $txt1 -> grid(-row=>1, -column=>1); $srl -> grid(-row=>1, -column=>2,-sticky=>"ns"); my $txt2 = $frm_5 -> Text(-width => 15, -height =>20) -> pack(-side=>"right", -anchor => 'e'); MainLoop; #73 #Executed START BUTTON sub push_start { open my $fh,'<','/home/terrance/Desktop/perl/record.tx +t' || die $!; my @contents = <$fh>; foreach my $line (@contetns) { $txt1 ->insert("end", $line); + } #$txt1 -> insert ('end', "hello due\n"); }

In reply to read file in perl/tk( text ) by terrance

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.