I need to search in a directory for all the files that end in .123.
How do I (using Perl) get a list of开发者_高级运维 those files?
Simply:
@files = glob "$dirname/*.123";
One way is to use glob:
use warnings;
use strict;
my @files = grep { -f } glob '*.123';
glob
should do the job.
If you want to search recursively, you can use File::Find
.
精彩评论