my $ok_but = $bf->Button( -text => 'Continue', -width => 10, -command => sub { ($idx) = $list_box->curselection(); if ( defined $idx ){ $job = $jobs[$idx]; $mw->destroy(); } else { $mw->destroy(); } )->pack(-side => 'bottom', -padx => 10, -pady => 5); #### $top->Mainloop(); return $job if defined $job; return 0;