Oops. Yeah, sorry about that. I was thinking that it would create a closure, but I forgot that $_ is global so that doesn't work.
Change the map line to:
map { [Button => $_, -command => [\&replace, $_]] } @menu_items
and it should work just fine with that replace sub.
bbfu
Black flowers blossom
Fearless on my breath
In reply to Re5: Tk Menu question.
by bbfu
in thread Tk Menu question.
by perl_seeker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |