I am trying to identify the list of all .cpp files in my repository. I am using the following script:
use File::Find::Rule;
use strict;
use warnings;
my @files = File::Find::Rule->name('*.cpp');
print Dumper @files;
I get the following output:
$VAR1 = bless( {
'mindepth' => undef,
'maxdepth' => undef,
'extras' => {},
'subs' => {},
'iterator' => [],
'rules' => [
{
'args' => [
'*.cpp'
],
'rule' => 'name',
'code' => 'm{(?-xism:^(?=[^\\.])[^/]*\\.cpp$)}'
}
]
}, 'File::Find::Rule' );
I could not find any references online about fetching the list of files.
Can someone please point me to how to get the required list?
Thanks.
单程:
my @files = File::Find::Rule->file()->name('*.cpp')->in('.');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.