繁体   English   中英

使用File :: Find :: Rule获取Perl中的文件列表

[英]Using File::Find::Rule to get the list of files in Perl

我试图识别存储库中所有.cpp文件的列表。 我正在使用以下脚本:

use File::Find::Rule;
use strict;
use warnings;

my @files = File::Find::Rule->name('*.cpp');
print Dumper @files;

我得到以下输出:

$VAR1 = bless( {
             'mindepth' => undef,
             'maxdepth' => undef,
             'extras' => {},
             'subs' => {},
             'iterator' => [],
             'rules' => [
                          {
                            'args' => [
                                        '*.cpp'
                                      ],
                            'rule' => 'name',
                            'code' => 'm{(?-xism:^(?=[^\\.])[^/]*\\.cpp$)}'
                          }
                        ]
           }, 'File::Find::Rule' );

我在网上找不到任何有关获取文件列表的参考。

有人可以指出我如何获得所需清单吗?

谢谢。

单程:

my @files = File::Find::Rule->file()->name('*.cpp')->in('.');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM