in reply to return an array from File::Find
After you guessed, did you check your syntax (perl -c scriptname.pl)?
Unmatched right curly bracket at findfiles.pl line 5, at end of line syntax error at findfiles.pl line 5, near "}" findfiles.pl had compilation errors.
So, adopting the answer from ForgotPasswordAgain above,
#!/usr/bin/perl use strict; use warnings; use File::Find; my $dirphoto = "/home/ww"; my @array; find(sub { push @array, $File::Find::name }, $dirphoto); for (@array) { print "$_ \n";} print "done\n";
should get the job done.
Note also that using strict and warnings revealed several other issues with your guess; issues they would have helped you correct.
|
|---|