my $var; my $dialog = $mw->Dialog(...); $var = $dialog->Show(); $dialog->bind('',sub{$var = 'ok'});