somya99 has asked for the wisdom of the Perl Monks concerning the following question:
but the if condition is not working and its returning nothing in the output. However if i remove the if, it is printing the list of all files and directories. Can anybody tell what is the problem in it?$dirname = "C:/Perl/Test"; opendir(DIR,$dirname); @file1 = readdir(DIR); foreach $file1(@file1) { if (-f $file1) { print("$file1\n"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is "If" condition not working
by davido (Cardinal) on Jul 03, 2011 at 06:04 UTC | |
|
Re: Why is "If" condition not working
by GrandFather (Saint) on Jul 03, 2011 at 06:07 UTC | |
|
Re: Why is "If" condition not working
by Marshall (Canon) on Jul 03, 2011 at 13:01 UTC | |
|
Re: Why is "If" condition not working
by bart (Canon) on Jul 03, 2011 at 19:27 UTC |