$vary's scope is wrong. If you move "my $vary = 0" into sub dude where "my $varx" is, this will work more like the way you want (I promise). The way you have it, the value of $vary increases every time you push the button, instead of being set back to zero like $varx.

You should remove the "my $varx, my $vary" from the top. You only need them in the for loop of sub dude. You should start learning to program with "use strict" on. That means declaring all your variables the first time with my. I think that will also help prevent you from making these kind of mistakes. So the first part of this program would look like:
#!/usr/bin/perl -w use strict; use Tk; my $MainWindow = MainWindow->new; $MainWindow->geometry("420x420"); $MainWindow->configure(-background => "black"); my $m = 0; my $bfa = 0; my $n=0; my @ButtFunc; my @montharr; my @Jularr;
Getting used to "use strict" is important as apparently the next release of perl will not give you a choice about it. Once you start, it is easy and there is never a reason to go back.

Nice geometry ;) EST

PS. put line breaks in your code around 80 characters or something, at least when you post. I can't stand scrolling horizontally...

In reply to Re: TK Destroy func by halfcountplus
in thread TK Destroy func 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.