#!/usr/bin/perl5 -w #finds all .pm modules on a Unix box 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 print them to my file "LDT_results.txt" print "$_\n" for @foundfiles; print MYOUTPUT "$_\n" for @foundfiles; close MYOUTPUT;