簡體   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