in reply to Capturing and then opening multiple files

Hello Peter Keystrokes,

As the fellow monk choroba has provided you an answer to your question already, I wanted to answer the last part of your question (How then do I capture all the files with the extension of my choice so that I can then open those files to extract data? ).

Take a look for the module File::Find::Rule. Why I propose this? Simple, multiple directories and also Directory Recursion.

Sample of solution (for testing purposes I used .txt extension you can use .csv).

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use File::Find::Rule; my @dirs = @ARGV ? @ARGV : ('.'); my $level = shift // 2; my @files = File::Find::Rule->file() ->name('*.txt') ->maxdepth($level) ->in(@dirs); print Dumper(\@files); __END__ $ perl main.pl $VAR1 = [ 'test.txt', 'counts.txt', 'SubFolder/foo.txt' ];

Update: I updated the output to an array as the user wants an array output.

Seeking for Perl wisdom...on the process of learning...not there...yet!