On Tue, Dec 24, 2002 at 11:58:56AM -0600, Jeff Lowrey wrote: > At 12:38 PM -0500 12/24/02, Nestor, John wrote: > >> tell application "MacPerl" > >> activate > >> with timeout of 6000 seconds > >> set PathString to Do Script " > >> #!perl -w > >> > >> use File::Find; > >> > >> # I should wind up with an array of full paths, right? > >> @files=find(\\&wanted, 'Macintosh HD:'); > >> # I'm playing is safe and returning a string-- > > Then why not create a string in the first place? > > > > #I know I can pass strings back and forth--hey, I'm a beginner, > > remember? > >> :) > >> $files=join(\",\",@files); > >> MacPerl::Reply($files); > >> > >> sub wanted { > >> if ($_ =~ m/Pearson Translator/){ > > > push (@paths, $File::Find::name); > > > } > >> return @paths; > > Are you sure that you're supposed to return an array from the wanted > function? Are you sure returning "@paths" will actually return the > array, and not something else? Maybe you should return a reference > to the array?
The return value of the wanted() function is ignored, so it doesn't matter what you return. Whatever you want to do should be done as a side-effect of the wanted() function; in this case, pushing the file path onto an array. my @files; find(\&wanted, 'Macintosh HD'); my $files = join ',', @files; sub wanted { if ($_ =~ /Pearson Translator/) { push @files, $File::Find::name; } } Ronald