$txtapitimhsh -> delete('1.0', 'end'); #### use strict; use warnings; use Tk; my @totalmetoxwn = ( ); my $telikitimh = 100; my $sunolometoxwn = 0; my $mw = new MainWindow; my $frm_name3 = $mw -> Frame() -> pack(); my $frm_name4 = $mw -> Frame() -> pack(); my $addbutton = $frm_name3 -> Button(-text => "Prosthesi", -command =>\&push_button); $addbutton->pack(-side=>'left'); my $txtapitimhsh = $frm_name4 -> Text(-width=>8, -height=>1); $txtapitimhsh -> pack(-side=>'right'); MainLoop; sub push_button { @totalmetoxwn = ( ); push(@totalmetoxwn, $telikitimh); foreach (@totalmetoxwn) { $sunolometoxwn += $_ ; #here i get the previous value and the new one $txtapitimhsh -> delete('1.0', 'end'); $txtapitimhsh -> insert('end', $sunolometoxwn); } }