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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -