$mw->Label(-text=>"level1 ")->grid( $mw->Optionmenu(-textvariable=>\$selectedDir, -command=> sub{ @files=`ls $path/$selectedDir`; foreach (@files) {chomp();} }, -options=>\@myArr), $mw->Label(-text=>"level2 "), $mw->Optionmenu(-textvariable=>\$myFile, -options=>\@files) );