sub getFileList { my @fileList = (); # list for matching files my $findFilter = sub { if ( /\.hhc$/ ) { # only push matching filenames my $curDir = cwd; my $fileName = $curDir . $_; push @fileList, $fileName; } return; }; find($findFilter, "."); # populates the list return @fileList; } #### use File::Find::Rule; my @files = find( file => name => '*.hhc', dir => '.' );