The code behind a button to begin a search is as follows: sub ::btnSearch_Click{defined(my $win = $Win32::GUI::Loft::window{"Search and Delete"} ) or return(1); # check path acceptable since user may have altered the default $path = $win-> tfSearchPrefix-> Text; if (!(-e "$path")) { $win-> reReport-> Text("Search path does not exist ..."); return; } else { $win-> reReport-> Text("Searching for media files ..."); }; # open link to text storage file for each extension checked sleep(4); foreach (@ext) { my $fh; # filehandle my $extension = getdcwd()."\\Extensions\\$_\.txt"; # holds matching file extensions open ($fh, ">$extension") or die "Cannot open $_ for write :$!"; $handle{$_}= $fh; }; find({wanted => \&wanted, no_chdir=>1}, $path); # close link to storage file for each extension foreach (@ext) { close $handle{$_}; }; $win-> reReport-> Text("Finished Searching"); } and the subroutine wanted is defined as follows: sub wanted {defined(my $win = $Win32::GUI::Loft::window{"Search and Delete"} ) or return(1); if (!("$File::Find::dir"=~/}/)&&(/\.asf$|\.mp.{0,2}$|\.avi$|\.exe$|\.wav$|\.zip$|\.mov$|\.rm.?$ |\.wm.?$|\.qt$|\.mid.?$|\.ra.?$|\.swf$|\.pst$|\.ogg$|\.gho$/i)) { my ($type) = /\.(\w\w)\w?$/; print {$handle{lc $type}} "$_\n"; } }