
Newbie: problems with chdir & opendir()
Hi all,
I am a newbie to Perl and need some urgent help.
I am trying to get a list of files stored on a network server. I am
using ActivePerl & WinNT4.
I am trying to change to the folder, either with UNC or via the shared
drive letter(with chdir) but with no luck.
The weird thing is that the code below works fine from the command
line, but as soon as I use it through a browser (IE 5.5 & NN 4.7) it
mis-behaves.
When run through a browser it produces a list of files in the current
working folder on my C: drive and not the remote folder.
What am I doing wrong ?
Sample Code:
$name = "V:/somefolder/";
chdir("V:/somefolder");
opendir(DIR, $name)
or die "Can't open $name due to $!";
$entry = readdir(DIR);
while ( defined($entry) ) {
print "$entry\n";
# Get next entry.
$entry = readdir(DIR);
Quote:
}
# Close directory handle when done.
closedir(DIR);
Thanks in Advance
David