in reply to Extract information from several files in directory

One thing to be aware of is that readdir() returns file names without the directory part. If using readdir() you will need to prepend the file names with the directory part of the file path in order to open it for reading.

You could just build the path yourself, which is not necessarily portable.

my $path = "Filer/$filename";

or you could use File::Spec->catfile() for portability

use File::Spec; my $path = File::Spec->catfile('Filer', $filename");

This is an old fashioned approach.

If you use glob() it will return file paths. Then again for portability code>File::Spec->catfile()</code> could be used to build the argument to glob().

As others have pointed out, using Path::Tiny simple. It is a more modern approach. For example

my @paths = path("Filer")->children( qr/\.txt\z/ ); # now do something with each element of @paths