in reply to Re: Re3: Tk Menu question.
in thread Tk Menu question.

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

Replies are listed 'Best First'.
Re: Re5: Tk Menu question.
by perl_seeker (Scribe) on Oct 10, 2003 at 05:41 UTC
    Hi :),
    Yes that works.Thanks a lot.
    :)