M
mike
hi
i have a directory testdir with a single file called test.txt
i tried to stat the file like this
opendir(DIR, "$dir" ) or die "Cannot open directory $dir\n";
my @list = readdir(DIR) or die "Unable to enter directory $dir\n";
foreach ( @list)
{
local $name = $_;
next if ( "$name" eq "." );
next if ( "$name" eq "..") ;
my $size = (stat($name))[7];
print "size is $size\n";
}
the output shows: size is
the size is not shown. Even if i change the stat statement to
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($name);
the result is still the same..
what is wrong with the code? I am using 5.005_03
thanks
i have a directory testdir with a single file called test.txt
i tried to stat the file like this
opendir(DIR, "$dir" ) or die "Cannot open directory $dir\n";
my @list = readdir(DIR) or die "Unable to enter directory $dir\n";
foreach ( @list)
{
local $name = $_;
next if ( "$name" eq "." );
next if ( "$name" eq "..") ;
my $size = (stat($name))[7];
print "size is $size\n";
}
the output shows: size is
the size is not shown. Even if i change the stat statement to
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($name);
the result is still the same..
what is wrong with the code? I am using 5.005_03
thanks