Why your code sub { selectAccount(+$i) } works?
And why my code sub { &selectAccount(+$i) } did not?
... I have always been using with the ampersand with binds.
Further to tybalt89's reply...
The & (ampersand) has nothing to do with it. (Likewise the + (plus) sign in front of the $i; I don't know where that came from.) The trick is to switch from your C-style for (my $i=1; $i<200; $i++) { ... } loop to a Perl-style for my $i (1..200) { ... } loop.
In the C-style loop, the variable $i is defined once and given many values, the last of which is 200 (because that's the value that finally fails the $i<200 test). All the sub { selectAccount($i) } and sub { markAccount($i) } expressions symbolicly reference (if that's the right term) this single $i variable which has only one final value. At the end of the InitializeListBox() routine, the referential bindings "close" over the single $i variable (with its single value) because all symbolic references to the variable are used within code references which are passed to another subroutine, tag(), and must therefore persist. (Again, I may not have quite the right terminology here, but that's the general idea.)
In the Perl-style loop, the $i variable is aliased to many different values. Each sub { ... } expression symbolically references a different value via the $i alias. All these different, individual values are then closed over. I think that's about right.
See closure.
As to your other, Tk-related questions, it's been a while since I've played with Tk very much and someone else could, I'm sure, give you much better answers with much less mental effort.
Update: Made a few minor changes to wording in the interest, I hope, of clarity.
Give a man a fish: <%-{-{-{-<
In reply to Re^3: problem with TK, tag, passing param with binding, destroying binds
by AnomalousMonk
in thread problem with TK, tag, passing param with binding, destroying binds
by jsteng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |