This is what happened.  The Perl process did change dir, but remember when
it ends
it goes with all its baggage, so the parent process does not have anything
to do
with the chdir.


Try this:


#!/opt/local/bin/perl

$dirname = "./TEST";

chdir("$dirname");  #this sets current directory to ./TEST
                    #you could grab the return value ate see
                    #if operation was successfull
                    #i.e., $a = chdir("TEST"); 0=> success, 1 otherwise


#..........  then you could do either of the following .............
# 1./ UNIX platform specific
$b = `ls -l`;
print "\n\n Files in $dirname are: \n$b\n\n";

#........... any platform ........................
# OR

chdir("../");      #reposition directory pointer

opendir(CURDIR, "$dirname") ||  die ("\n\nUnable to open directory
$dirname\n\n");
while ($filename = readdir(CURDIR)) {
   print "$filename\n";
}

closedir(CURDIR);

__________________

William Ampeh (x3939)
Federal Reserve Board


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to