rucha:
If I had to guess, I'd guess that you have the .pl and .pm files in your current directory, and that d:/perlnew/ex/comp is a test directory, which contains the .pl and .pm files, along with other files. Since there's no directory prefix, the -f function is checking your local directory rather than the directory you've done the readdir from.
If your current directory is actually d:/perlnew/ex/comp when you run your script, then I can't think of a reason that readdir would see the files and -f wouldn't.
...roboticus