Re: problem about the perl code. thanks for any comments



yezi wrote:
>
     Hi all: the following is my program , Do not know why it can not
open file (*.RD ) in the current directory. Thanks for any comments.

As has been pointed out - checking and printing the results of opendir and open will tell you that.


   Other comments...

     24 opendir DIR,".";
     25 @files = readdir DIR;

You've forgotten the closedir().

26 foreach $file (@files)

Why not just loop on the readdir DIR, rather than slurping it into an array?


     27 {
     28         if ($file =~ /\.RD/)
     29         {
     30           $sitename=chomp($file);

Why are you chomp()ing? You are reading entrynames from a directory - if any of them ends with your $/ contents then it really does need them.




--
             Just because I've written it doesn't mean that
                  either you or I have to believe it.
.