欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Perl使用chdir的實(shí)例代碼

 更新時(shí)間:2013年02月05日 13:58:37   作者:  
Perl使用chdir的例子,供朋友們參考學(xué)習(xí)

復(fù)制代碼 代碼如下:

use strict;
use warnings;

# Print all files in a directory
sub print_files {
    my $dir = 'd:/code';
    opendir DIR, $dir or die $!;
    my @files = readdir DIR;
    chdir $dir; # Use chdir or -f will not work, since -f need absolutely path
    foreach my $file (@files) {
        if (-f $file) {
            print "$file\n";
        }
    }
    closedir DIR;
}

&print_files();

相關(guān)文章

最新評(píng)論