# It handles right-clicks on all entries of the main window $mwindow->bind("Tk::Entry", "", \&process_context_click ); # It makes the menu row 'Copy' and calls the sub callback my $popup = $mwindow->Menu( -tearoff => 0, -menuitems => [ ['command' => "~Copy", -command => \&callback] ] ); # It must copy the content of the event's entry to the clipboard, but. +.. {# private scope my $entry; sub process_context_click{ $entry = shift; $popup->Popup( -popover => "cursor", -popanchor => 'nw' ) } sub callback { my $f = $entry; my $g = $f->get(); $mw->clipboardAppend($g); } }