1. #Read a list of files from the cur/wkg/dir and insert them in the 'Load' menu bar ; 2. opendir(DIR, $dir); 3. @dirList = readdir(DIR); 4. closedir(DIR); 5. # Sort the list; 6. @dirList = sort @dirList; 7. foreach $fn (@dirList) { 8. $Load_mb -> command(-label => $fn, 9. -command => sub {&Load ($fn)} ); 10. } ; # End foreach; 11. 12. sub Load { 13. $Title = "Loading $_[0] "; 14. $Main_Window -> title($Title); 15. #Do something clever with whichever menu item was requested; 16. }