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"); } }
In reply to Why is "If" condition not working by somya99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |