in reply to Re^4: Global vs. local?
in thread Global vs. local?

You are not using strict, which would have enforced proper declaration of your lexical variables as lexicals:

sub execute_Click { another_sub(); foreach $j (0..$i-1) {

Here, $j is a global variable, which use strict; would tell you about. You need to write this as:

sub execute_Click { another_sub(); foreach $my j (0..$i-1) {

so that each subroutine gets its own copy of $j instead of them all using the one, shared $j.

strict also has the convenient feature of alerting you to mistyped variable names, which is why I recommend to use it always.