perl File::Find模块
1 #遍历一个文件夹 2 3 use File::Find; 4 5 my $path = '/home/test/'; 6 sub process 7 { 8 if ( -f $File::Find::name ) 9 { 10 if ( $File::Find::name =~ /\.old$/ ) 11 { 12 print "$File::Find::name\n"; 13 } 14 } 15 } 16 17 find( \&process, $path );