directory - -f command in Perl not working on my system -
i have windows 7, trying open directory , print filenames in directory -f command not working on system. program follows:
enter code here $directory = '\users'; opendir(dir, $directory) or die $!; while ($file = readdir(dir)){ if(-f $file){ print "$file\n"; } } closedir(dir);
can tell me what's wrong? in advance.
you're missing path file.
it should this:
if(-f "$directory/$file") {
Comments
Post a Comment