利用perl读取目录下的文件列表

v1.0

#读取当前目录下的文件名列表
use strict;
opendir TMP, "./" || die "cannot open dir";
open RES, ">./file_list.txt" || die "Cannot open and write";
foreach (readdir TMP){
    if(/.+\.pdf/){
        print RES "$_\n";
    }
}