#!/usr/bin/perl5 -w use strict; use File::Find; my $report = "LDT_results.txt"; open MYOUTPUT, "> $report" or die "Can't open $report: $!"; my @directories = ("/usr/local/lib"); my @foundfiles; # Collect all .pm files below each directory in @directories # and put them into @foundfiles find ( sub { push @foundfiles, $File::Find::name if /\.pm$/ }, @directories); # and output them all to the screen so I can see it's working my $pms = join("\n", @foundfiles), "\n"; print $pms; #and print them to my file "LDT_results.txt" print MYOUTPUT $pms; close MYOUTPUT;