通过本文主要向大家介绍了perl chdir,chdir,os.chdir,chdir函数,python os.chdir等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
# 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();
</div>

