在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 use strict; 2 use warnings; 3 use Cwd; 4 my $dir = 'd:\\www'; 5 chdir($dir); 6 opendir DIR, $dir or die "Cannot open dir:$!\n"; 7 my %result; 8 while(my $filename = readdir(DIR)){ 9 next if (($filename eq '.') or ($filename eq '..')); 10 if(-d $filename){$result{$filename} = "Is dir";next;} 11 my $byts = -s $filename; 12 $result{"$filename"} = $byts."byts"; 13 } 14 while((my $key, my $value) = each %result){ 15 print "$key => $value\n"; 16 }
|
请发表评论