sub add_button { #add button entries my $addframe = $frm_name4->Frame( -background=>'yellow', -relief=>'groove', -borderwidth=>5) ->pack(-side=>'top', -fill =>'x'); my $addtxtcount = $addframe->Text( -width=>1, -height=>1) ->pack(-side=>'left', -anchor =>'nw'); # my $addtxtexpense = $addframe->Text( -width=>8, -height=>1) ->pack(-side=>'left', -anchor =>'nw', -padx=>5); my $addtxtcost = $addframe->Text( -width=>8, -height=>1) -> pack(-side=>'left', -anchor =>'nw', -padx=>10); chomp(my $expense = $expenseentry->get()); $expenseentry -> delete('0', 'end'); $addtxtexpense->insert('end',$expense); #cost posting chomp(my $cost = $costentry->get()); $costentry-> delete('0','end'); $addtxtcost->insert('end',$cost); #countig posting $count ++; $addtxtcount->insert('end',$count); #calculate balance my @totalbalance = 0; push(@totalbalance,$cost); foreach( @totalbalance) { my $total += $_; ##write new balance $balancetxt->delete('1.0','end'); $balancetxt->insert('end',$total); #open WRITEFILE , ">>$time.txt" or die "write error\n"; #print WRITEFILE ("$count) $expense $cost \n"); #close WRITEFILE; } }
i do get the explicit package name error. Maybe the subroutine is totally wrong!

In reply to Re^4: Tk subroutine by props
in thread Tk subroutine by props

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.