- 论坛徽章:
- 0
|
为何不谢我呢?
$ cat find.pl
#!perl
use File::Find;
use Cwd;
find(\&wanted, '/home/he');
sub wanted {
my $curdir;
$curdir = getcwd();
next if /^\./;
print "$curdir/$_\n" if(-f && /\d\.txt$/);
}
he@he-THINK ~/manson
$ vi find.pl
he@he-THINK ~/manson
$ perl find.pl
/home/he/manson/A:/home/he/manson/A/1.txt
/home/he/manson/A:/home/he/manson/A/2.txt
/home/he/manson/A:/home/he/manson/A/3.txt
/home/he/manson/A/B:/home/he/manson/A/B/4.txt
/home/he/manson/A/B:/home/he/manson/A/B/5.txt
/home/he/manson/A/B:/home/he/manson/A/B/6.txt
/home/he/manson/A/B/C:/home/he/manson/A/B/C/7.txt
/home/he/manson/A/B/C:/home/he/manson/A/B/C/8.txt
/home/he/manson/A/B/C:/home/he/manson/A/B/C/9.txt
|
|