Mark Harris wrote:
# Always use strict and warnings.
use strict;
use warnings;
: use Win32::File;
: $dirspec = "c:\\xfer";
# / is the preferred perl directory separator
# (even on windows).
my $dirspec = 'c:/xfer';
Following Tom's advice we might do this.
: opendir(DS, $dirspec);
# Alway
On 6/23/06, Mark Harris <[EMAIL PROTECTED]> wrote:
opendir(DS, $dirspec);
You should probably use the "... or die" idiom, in case the opendir
fails, much as you would with open.
while($fn = readdir(DS))
{
if ( -d $fn)
The most common error when combining readdir() and the -x family of
On a windows xp machine, running the following code with active state
perl 5.8.8:
use Win32::File;
$dirspec = "c:\\xfer";
opendir(DS, $dirspec);
while($fn = readdir(DS))
{
if ( -d $fn)
{
print "$fn is a directory\n";
}
else
{
print "$fn is not a directory\n";